aboutsummaryrefslogtreecommitdiffstats
path: root/udev_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'udev_sysfs.c')
-rw-r--r--udev_sysfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/udev_sysfs.c b/udev_sysfs.c
index 34ae9ac1..d5b04c31 100644
--- a/udev_sysfs.c
+++ b/udev_sysfs.c
@@ -355,6 +355,8 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name)
dbg("open '%s'/'%s'", devpath, attr_name);
sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full));
+ if(sysfs_len >= sizeof(path_full))
+ sysfs_len = sizeof(path_full) - 1;
path = &path_full[sysfs_len];
strlcat(path_full, devpath, sizeof(path_full));
strlcat(path_full, "/", sizeof(path_full));