Alternative functions that limit the number of bytes copied are often recommended to mitigate buffer overflow vulnerabilities. For example:
strncpy() instead of strcpy()strncat() instead of strcat()fgets() instead of gets()snprintf() instead of sprintf()| These functions truncate strings that exceed the specified limits. Additionally, some functions such as {{strncpy()}} do not guarantee that the resulting string is null-terminated \[[STR33-C|STR32-C. Guarantee that all byte strings are null-terminated]\]. | 
Unintentional truncation results in a loss of data and, in some cases, leads to software vulnerabilities.
An exception to this rule applies if the intent of the programmer was to intentionally truncate the null-terminated byte string. To be compliant with this standard, this intent must be clearly stated in comments.
| Rule | Severity | Likelihood | Remediation Cost | Priority | Level | 
|---|---|---|---|---|---|
| STR03-A | 1 (low) | 1 (unlikely) | 2 (medium) | P2 | L3 |