...
It is rare for a violation of this rule to result in a security vulnerability unless it occurs in security-sensitive code. However, violations of this rule can easily result in lost or misinterpreted data.
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
ERR34-C | Medium | Unlikely | Medium | P4 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Clang |
| cert-err34-c | Checked by clang-tidy | ||||||
| CodeSonar |
| BADFUNC.ATOF (customization) | Use of atof Users can add custom checks for uses of other undesirable conversion functions. | ||||||
| Compass/ROSE |
Can detect violations of this recommendation by flagging invocations of the following functions:
| ||||||||
| Klocwork |
| MISRA.STDLIB.ATOI |
| LDRA tool suite |
| 44 S | Fully implemented | ||||||
| Parasoft C/C++test |
|
|
| MISRA2004-20_10 | Fully implemented | ||||||
| R2016b | Unsafe conversion from string to numeric value | String to number conversion without validation checks | ||||||
| PRQA QA-C++ |
| 5016 |
| PRQA QA-C |
| 5030 | Partially implemented | ||||||
| SonarQube C/C++ Plugin |
| S989 |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...
Key here (explains table format and definitions)
Taxonomy | Taxonomy item | Relationship |
|---|---|---|
| CERT C | INT06-CPP. Use strtol() or a related function to convert a string token to an integer | Prior to 2018-01-12: CERT: Unspecified Relationship |
| CWE 2.11 | CWE-676, Use of potentially dangerous function | 2017-05-18: CERT: Rule subset of CWE |
| CWE 2.11 | CWE-758 | 2017-06-29: CERT: Partial overlap |
CERT-CWE Mapping Notes
Key here for mapping notes
...
- The ato*() or scanf() family receives input that is not a number when trying to parse one
Bibliography
| [ISO/IEC 9899:2011] | Subclause 7.22.1, "Numeric conversion functions" Subclause 7.21.6, "Formatted input/output functions" |
| [Klein 2002] |
...
...