summaryrefslogtreecommitdiff
path: root/udev/lib
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2008-10-21 22:42:15 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-10-21 23:55:13 +0200
commit111e4f81ff057fd5869d152a503ad982e2116f85 (patch)
tree5b8548f6c41f3b58ff615b43b8cfc76124ade155 /udev/lib
parent9a23e9e7754027775f62baec847b46703e20d166 (diff)
replace strncpy() with strlcpy()
The problem was strncpy() doesn't stop after writing the terminating NUL; by definition it goes on to zero the entire buffer. I spy another use of strncpy in udev_device_add_property_from_string(), which is responsible for another ~1% user cpu time... Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Diffstat (limited to 'udev/lib')
-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 5a43548736..f56db7ff15 100644
--- a/udev/lib/libudev-device.c
+++ b/udev/lib/libudev-device.c
@@ -1001,7 +1001,7 @@ struct udev_list_entry *udev_device_add_property_from_string(struct udev_device
char name[UTIL_PATH_SIZE];
char *val;
- strncpy(name, property, sizeof(name));
+ util_strlcpy(name, property, sizeof(name));
val = strchr(name, '=');
if (val == NULL)
return NULL;