Author: tijl
Date: Fri Jan 27 10:05:17 2017
New Revision: 312873
URL: https://svnweb.freebsd.org/changeset/base/312873

Log:
  MFC r312699:
  
  Apply r210555 to 64 bit linux support:
  
  The interpreter name should no longer be treated as a buffer that can be
  overwritten.
  
  PR:           216346

Modified:
  stable/10/sys/amd64/linux/linux_sysvec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/linux/linux_sysvec.c
==============================================================================
--- stable/10/sys/amd64/linux/linux_sysvec.c    Fri Jan 27 10:03:50 2017        
(r312872)
+++ stable/10/sys/amd64/linux/linux_sysvec.c    Fri Jan 27 10:05:17 2017        
(r312873)
@@ -718,7 +718,7 @@ exec_linux_imgact_try(struct image_param
 {
        const char *head = (const char *)imgp->image_header;
        char *rpath;
-       int error = -1, len;
+       int error = -1;
 
        /*
         * The interpreter for shell scripts run from a linux binary needs
@@ -736,17 +736,12 @@ exec_linux_imgact_try(struct image_param
                        linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc),
                            imgp->interpreter_name, UIO_SYSSPACE,
                            &rpath, 0, AT_FDCWD);
-                       if (rpath != NULL) {
-                               len = strlen(rpath) + 1;
-
-                               if (len <= MAXSHELLCMDLEN)
-                                       memcpy(imgp->interpreter_name,
-                                           rpath, len);
-                               free(rpath, M_TEMP);
-                       }
+                       if (rpath != NULL)
+                               imgp->args->fname_buf =
+                                   imgp->interpreter_name = rpath;
                }
        }
-       return(error);
+       return (error);
 }
 
 #define        LINUX_VSYSCALL_START            (-10UL << 20)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to