CWE-785: Use of Path Manipulation Function without Maximum-sized Buffer
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The product invokes a function for normalizing paths or file names, but it provides an output buffer that is smaller than the maximum possible size, such as PATH_MAX.
扩展描述
Passing an inadequately-sized output buffer to a path manipulation function can result in a buffer overflow. Such functions include realpath(), readlink(), PathAppend(), and others.
常见后果
影响范围: Integrity Confidentiality Availability
技术影响: Modify Memory Execute Unauthorized Code or Commands DoS: Crash, Exit, or Restart
潜在缓解措施
阶段: Implementation
描述: Always specify output buffers large enough to handle the maximum-size possible result from path manipulation functions.
引入模式
| 阶段 | 说明 |
|---|---|
| Implementation | - |
适用平台
编程语言
分类映射
| 分类名称 | 条目ID | 条目名称 | 映射适配度 |
|---|---|---|---|
| 7 Pernicious Kingdoms | - | Often Misused: File System | - |
| Software Fault Patterns | SFP9 | Faulty String Expansion | - |