udev: fix codesonar warnings
Fixed below systemd codesonar warning. isprint() is invoked here with an argument of signed type char, but only has defined behavior for int arguments that are either representable as unsigned char or equal to the value of macro EOF(-1). As per codesonar report, in a number of libc implementations, isprint() function implemented using lookup tables (arrays): passing in a negative value can result in a read underrun.
This commit is contained in:
committed by
Lennart Poettering
parent
b67ec8e5b2
commit
e7e954243a
@@ -100,7 +100,7 @@ static int print_all_attributes(sd_device *device, bool is_parent) {
|
||||
|
||||
/* skip nonprintable attributes */
|
||||
len = strlen(value);
|
||||
while (len > 0 && isprint(value[len-1]))
|
||||
while (len > 0 && isprint((unsigned char) value[len-1]))
|
||||
len--;
|
||||
if (len > 0)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user