...
A function that is registered as an exit handler by atexit()
must exit by returning, and not in any other manner.:
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdio.h> #include <stdlib.h> void exit1(void) { /* ...cleanup code... */ return; } void exit2(void) { if (/* condition */) { /* ...more cleanup code... */ } return; } int main(void) { if (atexit(exit1) != 0) { /* Handle error */ } if (atexit(exit2) != 0) { /* Handle error */ } /* ...program code... */ exit(0); } |
...
Tool | Version | Checker | Description |
---|---|---|---|
Compass/ROSE |
|
| Can detect violations of this rule. In particular, it ensures that all functions registered with |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...