Versions Compared

Key

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

According to C11the C Standard, Section 7.4 [ISO/IEC 9899:2011],

...

Note: XSI denotes an X/Open System Interfaces Extension to ISO/IEC 9945—POSIX®. The functions are not defined by the C standardStandard.

STR34-C. Cast characters to unsigned char before converting to larger integer sizes is a generalization of this rule.

...

Tool

Version

Checker

Description

Compass/ROSE

  

Could detect violations of this rule by seeing if the argument to a character-handling function (listed above) is not an unsigned char.

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V

charplan

Fully implemented.

PRQA QA-C
Include Page
PRQA_V
PRQA_V
special case of STR34Fully implemented.

Related Vulnerabilities

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

Related Guidelines

...

...

TR 17961(Draft) Passing arguments to character-handling functions that are not representable as unsigned char [chrsgnext]
MITRE CWE

...

...

Incorrect type conversion or cast

...


...

...

...

Function call with incorrect argument type

...

Bibliography

[ISO/IEC 9899:2011]Section 7.4, "Character Handling <ctype.h>"
[Kettlewell 2002]Section 1.1, "<ctype.h> and

...

Characters Types"

...