Main Content
Buffer overflow from incorrect string format specifier
String format specifier causes buffer argument of standard library functions to overflow
Description
This defect occurs when the format specifier argument
for functions such as sscanf
leads to an overflow
or underflow in the memory buffer argument.
Risk
If the format specifier specifies a precision that is greater than the memory buffer size, an overflow occurs. Overflows can cause unexpected behavior such as memory corruption.
Fix
Use a format specifier that is compatible with the memory buffer size.
Examples
Result Information
Group: Static memory |
Language: C | C++ |
Default: On for handwritten code, off for generated code |
Command-Line Syntax: STR_FORMAT_BUFFER_OVERFLOW |
Impact: High |
Version History
Introduced in R2015b
See Also
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)