AUTOSAR C++14 Rule M18-0-5
The unbounded functions of library <cstring> shall not be used
Description
The unbounded functions of library <cstring> shall not be used.
Rationale
The unbounded functions of library <cstring> does not check the
bounds of a buffer when reading from it or writing into it. This results in accessing a
buffer beyond its end, which is undefined behavior. Functions that reads a buffer beyond its
end include: strcpy, strcmp,
strcat, strchr, strspn,
strcspn, strpbrk, strrchr,
strstr, strtok and strlen.
Polyspace Implementation
Polyspace® reports a violation if you use any of these names in your code:
strcpystrcmpstrcatstrchrstrspnstrcspnstrpbrkstrrchrstrstrstrtokstrlen
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
| Group: Language Support Library |
| Category: Required, Automated |
PQL Name: std.autosar_cpp14.M18_0_5 |
Version History
Introduced in R2019a