summaryrefslogtreecommitdiff
path: root/udev/lib/libudev-device.c
diff options
context:
space:
mode:
Diffstat (limited to 'udev/lib/libudev-device.c')
-rw-r--r--udev/lib/libudev-device.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
index 1a9d0a1e69..e13cbe554b 100644
--- a/udev/lib/libudev-device.c
+++ b/udev/lib/libudev-device.c
@@ -303,7 +303,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *
/* path is not a root directory */
subdir = &syspath[len+1];
pos = strrchr(subdir, '/');
- if (pos == NULL || pos < &subdir[2]) {
+ if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) {
dbg(udev, "not a subdir :%s\n", syspath);
return NULL;
}