diff options
author | Alan Jenkins <alan-jenkins@tuffmail.co.uk> | 2008-09-09 00:48:17 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-09-09 00:48:17 +0200 |
commit | 9d7e1b3fdd3c2bd064f33a29ea5241fdefb718ee (patch) | |
tree | a2ffcbff7626fbdd0e5105b6432aa2cbffae771b /udev | |
parent | ab7ab02556871da195263fce1419a58261179479 (diff) |
fix off-by-one in pass_env_to_socket()
Diffstat (limited to 'udev')
-rw-r--r-- | udev/udev_rules.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/udev/udev_rules.c b/udev/udev_rules.c index 004a89f748..3b9631b883 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -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]); } - bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); + bufpos = snprintf(buf, sizeof(buf), "%s@%s", action, devpath); bufpos++; - for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)-1); i++) { - bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1); + for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)); i++) { + bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos); bufpos++; } if (bufpos > sizeof(buf)) |