1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 19:21:53 +03:00

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.
This commit is contained in:
Hendrik Brueckner 2016-02-19 15:21:18 +01:00
parent a972e1e0b3
commit 5181ab917d

View File

@ -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) {