CWE-253 — Incorrect Check of Function Return Value
CWE-253: Incorrect Check of Function Return Value
MITRE CWE weakness
| Kind | Weakness |
| Abstraction | Base |
| Status | Incomplete |
| Likelihood of exploit | Low |
Description
The product incorrectly checks a return value from a function, which prevents it from detecting errors or exceptional conditions.
Important and common functions will return some value about the success of its actions. This will alert the program whether or not to handle any errors caused by that function.
Common consequences
- Availability, Integrity: Unexpected State, DoS: Crash, Exit, or Restart
Mitigations
Architecture and Design — Use a language or compiler that uses exceptions and requires the catching of those exceptions.
Implementation — Properly check all functions which return a value.
Implementation — When designing any function make sure you return a value or throw an exception in case of an error.
References
- CWE page: https://cwe.mitre.org/data/definitions/253.html
- CWE list: https://cwe.mitre.org/data/index.html