Date: Tue, 24 Jan 2017 16:13:59 +0000 (UTC) From: Tijl Coosemans <tijl@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312699 - head/sys/amd64/linux Message-ID: <201701241613.v0OGDxLR096790@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tijl Date: Tue Jan 24 16:13:59 2017 New Revision: 312699 URL: https://svnweb.freebsd.org/changeset/base/312699 Log: Apply r210555 to 64 bit linux support: The interpreter name should no longer be treated as a buffer that can be overwritten. PR: 216346 MFC after: 3 days Modified: head/sys/amd64/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Tue Jan 24 16:05:42 2017 (r312698) +++ head/sys/amd64/linux/linux_sysvec.c Tue Jan 24 16:13:59 2017 (r312699) @@ -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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701241613.v0OGDxLR096790>