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:
Amitanand.Chikorde
2020-07-30 18:55:50 +02:00
committed by Lennart Poettering
parent b67ec8e5b2
commit e7e954243a
+1 -1
View File
@@ -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;