...
| | | |
| | | |
| | | |
| | | |
...
Noncompliant Code Example
This non-compliant noncompliant code example may pass invalid values to the isspace()
function.
Code Block | ||
---|---|---|
| ||
size_t count_preceding_whitespace(const char const *s) { const char const *t = s; size_t length = strlen(s) + 1; /* possibly *t < 0 */ while (isspace(*t) && (t - s < length)) { ++t; } return t - s; } |
...
Code Block | ||
---|---|---|
| ||
size_t count_preceding_whitespace(const char const *s) { const unsigned char *t = s; size_t length = strlen(s) + 1; while (isspace(*t) && (t - s < length)) { ++t; } return t - s; } |
...
Code Block | ||
---|---|---|
| ||
size_t count_preceding_whitespace(const char const *s) { const char const *t = s; size_t length = strlen(s) + 1; while (isspace((unsigned char)*t) && (t - s < length)) { ++t; } return t - s; } |
...