]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: make devpath check stricter
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 18 Feb 2021 15:41:08 +0000 (00:41 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 20 Feb 2021 19:40:23 +0000 (04:40 +0900)
See assertion in sd_device_get_devpath().

src/libsystemd/sd-device/sd-device.c

index 923c6f4fe7644b5be4afbfd94b6f99aea6c02de7..9b6255271f1af5feba654350c606844c9bcfbbd5 100644 (file)
@@ -198,7 +198,7 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
 
         devpath = syspath + STRLEN("/sys");
 
-        if (devpath[0] == '\0')
+        if (devpath[0] != '/')
                 /* '/sys' alone is not a valid device path */
                 return -ENODEV;