Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Truncating strings can lead to a loss of data.

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

STR03-C

Medium

Probable

Medium

P8

L2

Automated Detection

Tool

Version

Checker

Description

CodeSonar
Include Page
CodeSonar_V
CodeSonar_V
MISC.MEM.NTERMNo Space For Null Terminator
Compass/ROSE

 

 



Could detect violations in the following manner: all calls to strncpy() and the other functions should be followed by an assignment of a terminating character to null-terminate the string

GCC8.1-Wstringop-truncationDetects string truncation by strncat and strncpy.
Klocwork
Include Page
Klocwork_V
Klocwork_V

NNTS.MIGHT
NNTS.MUST

 


LDRA tool suite
Include Page
LDRA_V
LDRA_V

115 S, 44 S

Partially implemented

Parasoft C/C++test
Include Page
c:
Parasoft_V
c:
Parasoft_V
BD

CERT_C-

PB-OVERNZT

STR03-a

Avoid overflow due to reading a not zero terminated string

Polyspace Bug Finder

Include Page

 

Polyspace Bug Finder

R2016aBuffer overflow from incorrect string format specifierString format specifier causes buffer argument of standard library functions to overflow

_V
Polyspace Bug Finder_V

CERT C: Rec. STR03-C

Checks for invalid use of standard library string routine (rec. partially supported)

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

Bibliography

[Seacord 2013]Chapter 2, "Strings"

...


...