summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitanand.Chikorde <amitanand.chikorde@kpit.com>2020-07-30 18:48:48 +0530
committerLennart Poettering <lennart@poettering.net>2020-07-30 18:55:50 +0200
commite7e954243a17cceb5278aac6249ee0dcc119b1eb (patch)
tree7f770042355eb430db17ca54e625adf955e1b8c8
parentb67ec8e5b2e1a74d7e9a3a2b3ac60b7b2e39d4ea (diff)
downloadsystemd-e7e954243a17cceb5278aac6249ee0dcc119b1eb.tar.gz
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.
-rw-r--r--src/udev/udevadm-info.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index 7eec84abd5..ae6d8caf54 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -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;