27 lines
1 KiB
Diff
27 lines
1 KiB
Diff
From 3ae8b7b28757a4af3e3fcd9e7380d7dfbb6b295d Mon Sep 17 00:00:00 2001
|
|
From: Julian Winkler <julian.winkler1@web.de>
|
|
Date: Sat, 18 Feb 2023 22:55:01 +0100
|
|
Subject: [PATCH 2/2] udev: check idpath for nullptr before calling strcmp
|
|
|
|
Apparently the ID_PATH property can be null, which resulted in segfaults
|
|
without this patch. Fallback to empty string instead.
|
|
---
|
|
discover/udev.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/discover/udev.c b/discover/udev.c
|
|
index c81f3c4..b078dd7 100644
|
|
--- a/discover/udev.c
|
|
+++ b/discover/udev.c
|
|
@@ -181,7 +181,7 @@ static int udev_handle_block_add(struct pb_udev *udev, struct udev_device *dev,
|
|
/* We may see multipath devices; they'll have the same uuid as an
|
|
* existing device, so only parse the first. */
|
|
uuid = udev_device_get_property_value(dev, "ID_FS_UUID");
|
|
- idpath = udev_device_get_property_value(dev, "ID_PATH");
|
|
+ idpath = udev_device_get_property_value(dev, "ID_PATH") ?: "";
|
|
if (uuid) {
|
|
ddev = device_lookup_by_uuid(udev->handler, uuid);
|
|
if (ddev) {
|
|
--
|
|
2.39.1
|
|
|