Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jul 2017 06:12:21 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320665 - head/libexec/rtld-elf
Message-ID:  <201707050612.v656CLKP035778@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Wed Jul  5 06:12:21 2017
New Revision: 320665
URL: https://svnweb.freebsd.org/changeset/base/320665

Log:
  In open_binary_fd: when using buffer size for strl* and snprintf,
  always use >= instead of > to avoid truncation.
  
  Reviewed by:	kib
  Differential Revision:	https://reviews.freebsd.org/D11474
  MFC after:	3 days

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c	Wed Jul  5 05:50:36 2017	(r320664)
+++ head/libexec/rtld-elf/rtld.c	Wed Jul  5 06:12:21 2017	(r320665)
@@ -5300,14 +5300,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707050612.v656CLKP035778>