summaryrefslogtreecommitdiffstats
path: root/sys/amd64/linux
diff options
context:
space:
mode:
authortijl <tijl@FreeBSD.org>2017-01-27 10:05:17 +0000
committertijl <tijl@FreeBSD.org>2017-01-27 10:05:17 +0000
commit2e7e51bf20e15bc18031d492da74e0ddefbf1691 (patch)
tree4ef1cca25f8d87713548a16df7e0298f87035ceb /sys/amd64/linux
parent55d5874a2bd9ec6222fc79f59d3c164f81e117b2 (diff)
downloadFreeBSD-src-2e7e51bf20e15bc18031d492da74e0ddefbf1691.zip
FreeBSD-src-2e7e51bf20e15bc18031d492da74e0ddefbf1691.tar.gz
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
Diffstat (limited to 'sys/amd64/linux')
-rw-r--r--sys/amd64/linux/linux_sysvec.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c
index 13f9199..dba213b 100644
--- a/sys/amd64/linux/linux_sysvec.c
+++ b/sys/amd64/linux/linux_sysvec.c
@@ -718,7 +718,7 @@ exec_linux_imgact_try(struct image_params *imgp)
{
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_params *imgp)
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)
OpenPOWER on IntegriCloud