svn commit: r320799 - stable/11/libexec/rtld-elf

Xin LI delphij at FreeBSD.org
Sat Jul 8 04:30:13 UTC 2017


Author: delphij
Date: Sat Jul  8 04:30:11 2017
New Revision: 320799
URL: https://svnweb.freebsd.org/changeset/base/320799

Log:
  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.

Modified:
  stable/11/libexec/rtld-elf/rtld.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/11/libexec/rtld-elf/rtld.c	Sat Jul  8 02:02:49 2017	(r320798)
+++ stable/11/libexec/rtld-elf/rtld.c	Sat Jul  8 04:30:11 2017	(r320799)
@@ -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);


More information about the svn-src-all mailing list