chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
da96a11
)
Decrease buffer size when advancing past NUL byte
author
David Zeuthen
<davidz@redhat.com>
Tue, 2 Mar 2010 22:06:33 +0000
(17:06 -0500)
committer
David Zeuthen
<davidz@redhat.com>
Tue, 2 Mar 2010 22:06:33 +0000
(17:06 -0500)
Otherwise we'll overflow the buffer if space is tight. Also add a comment explaining this.
Signed-off-by: David Zeuthen <davidz@redhat.com>
libudev/libudev-device.c
patch
|
blob
|
history
diff --git
a/libudev/libudev-device.c
b/libudev/libudev-device.c
index 71fc775242e81ccad7f3cc930bd772f0649adbe0..4f42aa2810795af231bc7e0ccf28b08ec5739e72 100644
(file)
--- a/
libudev/libudev-device.c
+++ b/
libudev/libudev-device.c
@@
-1166,7
+1166,9
@@
static int update_envp_monitor_buf(struct udev_device *udev_device)
l = util_strpcpyl(&s, l, key, "=", udev_list_entry_get_value(list_entry), NULL);
if (l == 0)
return -EINVAL;
+ /* advance past the trailing '\0' that util_strpcpyl() guarantees */
s++;
+ l--;
}
udev_device->envp[i] = NULL;
udev_device->monitor_buf_len = s - udev_device->monitor_buf;