summaryrefslogtreecommitdiff
path: root/udev_sysfs.c
diff options
context:
space:
mode:
authorMichael Morony <michael.morony@gmail.com>2007-08-24 08:14:21 +0200
committerKay Sievers <kay.sievers@vrfy.org>2007-08-24 08:14:21 +0200
commit1f7a36f2c0953c60a8d7acadc281285a0b84fb46 (patch)
treeb36910854ba772c399da4ef6624443b5eba0b9fc /udev_sysfs.c
parent7e599863919a62b0a072b5ca7a0037527d54d335 (diff)
set buffer size if strlcpy/strlcat indicate truncation
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 34ae9ac14f..d5b04c310f 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));