summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortijl <tijl@FreeBSD.org>2017-01-27 10:06:20 +0000
committertijl <tijl@FreeBSD.org>2017-01-27 10:06:20 +0000
commit2e4d87b44d4c7e3eef53d671ebaba9175f21da11 (patch)
tree38df732c7a7fb688e018c5bf7f2fafed7af43bc9
parentad5779fe6ea575308965e56668f3e344b29d4842 (diff)
downloadFreeBSD-src-2e4d87b44d4c7e3eef53d671ebaba9175f21da11.zip
FreeBSD-src-2e4d87b44d4c7e3eef53d671ebaba9175f21da11.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
-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 c9f8302..6e12d41 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