...
This compliant solution repeats the same type in the sizeof expression and the pointer cast.:
| Code Block | ||||
|---|---|---|---|---|
| ||||
widget *p; /* ... */ p = (widget *)malloc(sizeof(widget)); |
...
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
Compass/ROSE |
|
| Can detect some violations of this recommendation when checking EXP36-C. Do not convert pointers into more strictly aligned pointer types. | ||||||
| ECLAIR |
| funcalls | Fully implemented. | ||||||
Fortify SCA | 5.0 |
| Can detect violations of this rule with CERT C Rule Pack. | ||||||
|
|
| |||||||
| PRQA QA-C |
| 0695 | Fully implemented. |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...