summaryrefslogtreecommitdiffstats
path: root/sys/i386/linux/linux_sysvec.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2010-07-28 04:47:40 +0000
committeralc <alc@FreeBSD.org>2010-07-28 04:47:40 +0000
commit55426fcc5559b40bb8d6c573b2d8d8ad2800814c (patch)
tree6c617e98de63b12d565bcd32c251edc6c5695673 /sys/i386/linux/linux_sysvec.c
parent7b4520f3c1f04effb671e914e42a998bb1902b65 (diff)
downloadFreeBSD-src-55426fcc5559b40bb8d6c573b2d8d8ad2800814c.zip
FreeBSD-src-55426fcc5559b40bb8d6c573b2d8d8ad2800814c.tar.gz
The interpreter name should no longer be treated as a buffer that can be
overwritten. (This change should have been included in r210545.) Submitted by: kib
Diffstat (limited to 'sys/i386/linux/linux_sysvec.c')
-rw-r--r--sys/i386/linux/linux_sysvec.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index 364cc0c..5658211 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -904,7 +904,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
@@ -920,17 +920,12 @@ exec_linux_imgact_try(struct image_params *imgp)
if ((error = exec_shell_imgact(imgp)) == 0) {
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);
}
/*
OpenPOWER on IntegriCloud