summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2017-07-08 04:30:11 +0000
committerdelphij <delphij@FreeBSD.org>2017-07-08 04:30:11 +0000
commit130dae121163e148ef3cf0c19c6909e23a20117e (patch)
tree1546c421e92c0428e07f259e728e39b1463c264b /libexec
parenta554d7db9335769536105134774a2b80e826f7b1 (diff)
downloadFreeBSD-src-130dae121163e148ef3cf0c19c6909e23a20117e.zip
FreeBSD-src-130dae121163e148ef3cf0c19c6909e23a20117e.tar.gz
MFC r320665:
In open_binary_fd: when using buffer size for strl* and snprintf, always use >= instead of > to avoid truncation. releng/11.1 candidate.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index d2fd37ee..b35dc0e 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -5295,14 +5295,14 @@ open_binary_fd(const char *argv0, bool search_in_path)
fd = -1;
errno = ENOENT;
while ((pe = strsep(&pathenv, ":")) != NULL) {
- if (strlcpy(binpath, pe, sizeof(binpath)) >
+ if (strlcpy(binpath, pe, sizeof(binpath)) >=
sizeof(binpath))
continue;
if (binpath[0] != '\0' &&
- strlcat(binpath, "/", sizeof(binpath)) >
+ strlcat(binpath, "/", sizeof(binpath)) >=
sizeof(binpath))
continue;
- if (strlcat(binpath, argv0, sizeof(binpath)) >
+ if (strlcat(binpath, argv0, sizeof(binpath)) >=
sizeof(binpath))
continue;
fd = open(binpath, O_RDONLY | O_CLOEXEC | O_VERIFY);
OpenPOWER on IntegriCloud