diff options
author | 2016-02-19 15:21:18 +0100 | |
---|---|---|
committer | 2016-03-05 10:57:24 -0500 | |
commit | 43e39396283c276612d6fd027a4d991318b05a56 (patch) | |
tree | 8856aa3a0e458e4ebc4dd267293091b5f4195c6b | |
parent | basic/strbuf: do not call bsearch with a null argument (diff) | |
download | systemd-43e39396283c276612d6fd027a4d991318b05a56.tar.gz systemd-43e39396283c276612d6fd027a4d991318b05a56.tar.bz2 systemd-43e39396283c276612d6fd027a4d991318b05a56.zip |
udev/path_id: correct segmentation fault due to missing NULL check
Running "udevadm test-builtin path_id /sys/devices/platform/" results
in a segmentation fault.
The problem is that udev_device_get_subsystem(dev) might return NULL
in a streq() call. Solve this problem by using streq_ptr() instead.
-rw-r--r-- | src/udev/udev-builtin-path_id.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c index b6ed45d8b..6e9adc6e9 100644 --- a/src/udev/udev-builtin-path_id.c +++ b/src/udev/udev-builtin-path_id.c @@ -712,7 +712,7 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool * devices do not expose their buses and do not provide a unique * and predictable name that way. */ - if (streq(udev_device_get_subsystem(dev), "block") && !supported_transport) + if (streq_ptr(udev_device_get_subsystem(dev), "block") && !supported_transport) path = mfree(path); if (path != NULL) { |