From: Alan Jenkins Date: Fri, 17 Oct 2008 11:19:54 +0000 (+0200) Subject: libudev: fix sysnum logic for digit-only device names X-Git-Tag: 174~1432 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=babcf3cb22af24725030ad795f2e41d024afced3;p=systemd libudev: fix sysnum logic for digit-only device names --- diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 65ba6e30..b5d42354 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -936,8 +936,13 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath } /* trailing number */ - while (isdigit(udev_device->sysname[--len])) + while (len > 0 && isdigit(udev_device->sysname[--len])) udev_device->sysnum = &udev_device->sysname[len]; + + /* sysname is completely numeric */ + if (len == 0) + udev_device->sysnum = NULL; + return 0; }