...
Do not pass an out of range value as an argument to std::string::opperator[]()
. Similarly, do not call std::string::back()
, or std::string::front()
on an empty string. This rule is a specific instance of CTR30CTR50-CPP. Guarantee that container indices and iterators are within the valid range.
Noncompliant Code Example
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
STR39-CPP | High | Unlikely | Medium | P6 | L2 |
Automated Detection
Tool | Version | Checker | Description |
---|---|---|---|
|
Related Vulnerabilities
...
Related Guidelines
CERT C++ Coding Standard | CTR30CTR50-CPP. Guarantee that container indices and iterators are within the valid range |
Bibliography
[ISO/IEC 14882-2014] | 21.4.5, " |
[Seacord 2013b] | Chapter 2, "Strings" |
...