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:
Konstantin Belousov 2011-03-06 22:59:30 +00:00
parent 1fee97b01f
commit 0ad4dd9a00
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219352

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);