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.
Threat Mapped score: 0.0
Industry: Finiancial
Threat priority: Unclassified
CVE: CVE-2023-49286
Chain: function in web caching proxy does not correctly check a return value (CWE-253) leading to a reachable assertion (CWE-617)
N/A
N/A
Phase | Note |
---|---|
Implementation | N/A |
Intro: This code attempts to allocate memory for 4 integers and checks if the allocation succeeds.
Body: The code assumes that only a negative return value would indicate an error, but malloc() may return a null pointer when there is an error. The value of tmp could then be equal to 0, and the error would be missed.
tmp = malloc(sizeof(int) * 4); if (tmp < 0 ) { perror("Failure"); //should have checked if the call returned 0 }