Versions Compared

Key

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

...

Code Block
bgColor#ccccff
size_t count_preceding_whitespace(const char *s) {
  const char *t = s;
  size_t length = strlen(s) + 1;

  while (isspace((unsigned char)*t) && (t - s < length)) {
    ++t;
  }
  return t - s;
}

Automated Detection

The tool 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.

Risk Assessment

Passing values to character handling functions that cannot be represented as an unsigned char may result in unintended program behavior.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

STR37-C

low

unlikely

low

P3

L3

Automated Detection

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.

Related Vulnerabilities

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

...