Call through non-prototyped function pointer
Function pointer declared without its type or number of parameters causes unexpected behavior
Description
This defect occurs when a function without a complete prototype is called using a function pointer.
A function prototype specifies the type and number of parameters.
Risk
Arguments passed to a function without a prototype might not match the number and type of parameters of the function definition, which can cause undefined behavior. If the parameters are restricted to a subset of their type domain, arguments from untrusted sources can trigger vulnerabilities in the called function.
Fix
Before calling the function through a pointer, provide a function prototype.
Examples
Result Information
Group: Programming |
Language: C |
Default: On for handwritten code, off for generated code |
Command-Line Syntax:
UNPROTOTYPED_FUNC_CALL
|
Impact: Medium |
Version History
Introduced in R2017b
See Also
Declaration mismatch
| Unreliable cast of function pointer
| Find defects (-checkers)
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)