...
Depending on the fonts used, certain characters appear visually similar or even identical:
Character | Similar Characters |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Do not define multiple identifiers that vary only with respect to one or more visually similar characters.
...
Failing to use visually distinct identifiers can result in referencing the wrong object or function, causing unintended program behavior.
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
DCL02-C | Low | Unlikely | Medium | P2 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| CodeSonar |
| LANG.ID.AMBIG | Typographically ambiguous identifiers | ||||||
| Compass/ROSE |
| CC2.DCL02 | Fully implemented | |||||||
| LDRA tool suite |
| 67 X | Fully implemented | ||||||
| Parasoft C/C++test |
|
|
| NAMING-44 |
| Implemented |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
| SEI CERT C++ Coding Standard | VOID DCL02-CPP. Use visually distinct identifiers |
| ISO/IEC TR 24772:2013 | Choice of Clear Names [NAI] |
| MISRA C:2012 | Directive 4.5 (advisory) |
...
...