mirror of
https://github.com/systemd/systemd.git
synced 2025-04-01 18:50:16 +03:00
Decrease buffer size when advancing past NUL byte
Otherwise we'll overflow the buffer if space is tight. Also add a comment explaining this. Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
parent
da96a11b9c
commit
ecd42de2c5
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user