Skip to content

Commit 5ca191c

Browse files
alarixniaalonbl
authored andcommitted
util: fix usage of ctype function
The argument of these functions is of type int, but only a very restricted subset of values are actually valid. The argument must either be the value of the macro EOF (which has a negative value), or must be a non-negative value within the range representable as unsigned char. Passing invalid values leads to undefined behavior. Signed-off-by: Nia Alarie <[email protected]>
1 parent f6cf300 commit 5ca191c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/pkcs11h-util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ _pkcs11h_util_escapeString (
179179

180180
while (*s != '\x0') {
181181

182-
if (*s == '\\' || strchr (invalid_chars, (unsigned char)*s) || !isgraph (*s)) {
182+
if (*s == '\\' || strchr (invalid_chars, (unsigned char)*s) || !isgraph ((unsigned char)*s)) {
183183
if (t != NULL) {
184184
if (n+4 > *max) {
185185
rv = CKR_ATTRIBUTE_VALUE_INVALID;

0 commit comments

Comments
 (0)