mirror of
https://github.com/systemd/systemd.git
synced 2025-02-04 21:47:31 +03:00
fix off-by-one in pass_env_to_socket()
This commit is contained in:
parent
ab7ab02556
commit
9d7e1b3fdd
@ -486,10 +486,10 @@ static int pass_env_to_socket(struct udev *udev, const char *sockpath, const cha
|
|||||||
saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]);
|
saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath);
|
bufpos = snprintf(buf, sizeof(buf), "%s@%s", action, devpath);
|
||||||
bufpos++;
|
bufpos++;
|
||||||
for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)-1); i++) {
|
for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)); i++) {
|
||||||
bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1);
|
bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos);
|
||||||
bufpos++;
|
bufpos++;
|
||||||
}
|
}
|
||||||
if (bufpos > sizeof(buf))
|
if (bufpos > sizeof(buf))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user