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
This commit is contained in:
Tijl Coosemans 2017-01-24 16:13:59 +00:00
parent bd84f70044
commit 86e01d5add

View File

@ -718,7 +718,7 @@ exec_linux_imgact_try(struct image_params *imgp)
{ {
const char *head = (const char *)imgp->image_header; const char *head = (const char *)imgp->image_header;
char *rpath; char *rpath;
int error = -1, len; int error = -1;
/* /*
* The interpreter for shell scripts run from a linux binary needs * 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), linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc),
imgp->interpreter_name, UIO_SYSSPACE, imgp->interpreter_name, UIO_SYSSPACE,
&rpath, 0, AT_FDCWD); &rpath, 0, AT_FDCWD);
if (rpath != NULL) { if (rpath != NULL)
len = strlen(rpath) + 1; imgp->args->fname_buf =
imgp->interpreter_name = rpath;
if (len <= MAXSHELLCMDLEN)
memcpy(imgp->interpreter_name,
rpath, len);
free(rpath, M_TEMP);
}
} }
} }
return(error); return (error);
} }
#define LINUX_VSYSCALL_START (-10UL << 20) #define LINUX_VSYSCALL_START (-10UL << 20)