summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2017-07-08 04:53:12 +0000
committerdelphij <delphij@FreeBSD.org>2017-07-08 04:53:12 +0000
commitc07dd91706ccd6d4e4d7e15cbe2daefcaf308acc (patch)
tree95136c1b2ac8c0d696a9843b144925b431638a9f
parent69815624ccd8aa087efe49176969757314424ec7 (diff)
downloadFreeBSD-src-c07dd91706ccd6d4e4d7e15cbe2daefcaf308acc.zip
FreeBSD-src-c07dd91706ccd6d4e4d7e15cbe2daefcaf308acc.tar.gz
MFS r320799: MFC r320665:
In open_binary_fd: when using buffer size for strl* and snprintf, always use >= instead of > to avoid truncation. Approved by: re (kib)
-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