803fb7
From fb9a50a0ad64f28c00c7d0bbc4ee8908d4233593 Mon Sep 17 00:00:00 2001
803fb7
From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
803fb7
Date: Fri, 19 Feb 2016 15:21:18 +0100
803fb7
Subject: [PATCH] udev/path_id: correct segmentation fault due to missing NULL
803fb7
 check
803fb7
803fb7
Running "udevadm test-builtin path_id /sys/devices/platform/" results
803fb7
in a segmentation fault.
803fb7
803fb7
The problem is that udev_device_get_subsystem(dev) might return NULL
803fb7
in a streq() call.  Solve this problem by using streq_ptr() instead.
803fb7
803fb7
Cherry-picked from: 5181ab917d6407cb57043e98955f0de1614366ea
803fb7
Resolves: #1365556
803fb7
---
803fb7
 src/udev/udev-builtin-path_id.c | 2 +-
803fb7
 1 file changed, 1 insertion(+), 1 deletion(-)
803fb7
803fb7
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
803fb7
index 8359e236a..a3b019bfc 100644
803fb7
--- a/src/udev/udev-builtin-path_id.c
803fb7
+++ b/src/udev/udev-builtin-path_id.c
803fb7
@@ -729,7 +729,7 @@ restart:
803fb7
          * devices do not expose their buses and do not provide a unique
803fb7
          * and predictable name that way.
803fb7
          */
803fb7
-        if (streq(udev_device_get_subsystem(dev), "block") && !supported_transport) {
803fb7
+        if (streq_ptr(udev_device_get_subsystem(dev), "block") && !supported_transport) {
803fb7
                 free(path);
803fb7
                 path = NULL;
803fb7
         }