ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Blob Blame History Raw
From fb9a50a0ad64f28c00c7d0bbc4ee8908d4233593 Mon Sep 17 00:00:00 2001
From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Date: Fri, 19 Feb 2016 15:21:18 +0100
Subject: [PATCH] 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.

Cherry-picked from: 5181ab917d6407cb57043e98955f0de1614366ea
Resolves: #1365556
---
 src/udev/udev-builtin-path_id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index 8359e23..a3b019b 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -729,7 +729,7 @@ restart:
          * 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) {
                 free(path);
                 path = NULL;
         }