The execution of the shebang script requires putting interpreter path,

possible option and script path in the place of argv[0] supplied to
execve(2).  It is possible and valid for the substitution to be shorter
then the argv[0].

Avoid signed underflow in this case.

Submitted by:	Devon H. O'Dell <devon.odell gmail com>
PR:	kern/155321
MFC after:	1 week
This commit is contained in:
kib 2011-03-06 22:59:30 +00:00
parent f56b79fee1
commit f3c6442b93

View File

@ -195,7 +195,7 @@ exec_shell_imgact(imgp)
length = (imgp->args->argc == 0) ? 0 :
strlen(imgp->args->begin_argv) + 1; /* bytes to delete */
if (offset - length > imgp->args->stringspace) {
if (offset > imgp->args->stringspace + length) {
if (sname != NULL)
sbuf_delete(sname);
return (E2BIG);