Author: delphij
Date: Sat Jul  8 04:53:12 2017
New Revision: 320800
URL: https://svnweb.freebsd.org/changeset/base/320800

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

Modified:
  releng/11.1/libexec/rtld-elf/rtld.c
Directory Properties:
  releng/11.1/   (props changed)

Modified: releng/11.1/libexec/rtld-elf/rtld.c
==============================================================================
--- releng/11.1/libexec/rtld-elf/rtld.c Sat Jul  8 04:30:11 2017        
(r320799)
+++ releng/11.1/libexec/rtld-elf/rtld.c Sat Jul  8 04:53:12 2017        
(r320800)
@@ -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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to