From: Yu Watanabe Date: Thu, 18 Feb 2021 15:41:08 +0000 (+0900) Subject: sd-device: make devpath check stricter X-Git-Tag: v248-rc1~19^2~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9dcde1034c86cbb3e566c3d147c737dc0d7698dd;p=thirdparty%2Fsystemd.git sd-device: make devpath check stricter See assertion in sd_device_get_devpath(). --- diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index 923c6f4fe76..9b6255271f1 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -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;