diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2008-11-17 02:01:37 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-11-17 02:01:37 +0100 |
commit | 096e59edc98646edb1072c646c631729bee04ad0 (patch) | |
tree | 911afc80c9c5cf845c62d553609ba48afef29ddc /udev/lib | |
parent | 56116314d114fb7e8a9c7ce6dc3ef4e929f9ecb0 (diff) |
limit $attr(<symlink>) magic to well-known links only
Diffstat (limited to 'udev/lib')
-rw-r--r-- | udev/lib/libudev-device.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index c4714e4088..055263bbef 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -859,11 +859,16 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const } if (S_ISLNK(statbuf.st_mode)) { - /* links return the last element of the target path */ char target[UTIL_NAME_SIZE]; int len; char *pos; + /* some core links return the last element of the target path */ + if (strcmp(sysattr, "driver") != 0 && + strcmp(sysattr, "subsystem") != 0 && + strcmp(sysattr, "module") != 0) + goto out; + len = readlink(path, target, sizeof(target)); if (len > 0) { target[len] = '\0'; |