gww@marduk.UUCP (Gary Winiger) (09/05/87)
Subject: execve(2) doesn't report ENOEXEC if ``#!'' line is too long. +Fix
Index: sys/kern_exec.c 4.3BSD +Fix
Description:
When executing a file which contains an ASCII line beginning with
``#!'' and that line is longer than SHSIZE, ENOEXEC is not reported.
Repeat-By:
Execute a file containing the following single line:
#! /usr/bin/../../bin/../bin/ls -Rgls
Fix:
The attached code solves this problem at Elxsi.
Gary..
{ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww
--------- cut --------- snip --------- :.,$w diff -------------
*** /tmp/,RCSt1000274 Fri Jun 19 12:29:02 1987
--- kern_exec.c Fri Jun 19 12:28:37 1987
***************
*** 1,6 ****
! /* $Header: kern_exec.c,v 1.1 87/04/08 14:49:36 gww Exp $ ENIX BSD
*
* $Log: kern_exec.c,v $
* Revision 1.1 87/04/08 14:49:36 gww
* Initial revision
*
--- 1,9 ----
! /* $Header: kern_exec.c,v 1.2 87/06/19 12:27:57 gww Exp $ ENIX BSD
*
* $Log: kern_exec.c,v $
+ * Revision 1.2 87/06/19 12:27:57 gww
+ * Correctly test for ASCII line (#!) being too long.
+ *
* Revision 1.1 87/04/08 14:49:36 gww
* Initial revision
*
***************
*** 159,165 ****
}
cp++;
}
! if (*cp != '\0') {
u.u_error = ENOEXEC;
goto bad;
}
--- 162,168 ----
}
cp++;
}
! if (cp >= &exdata.ex_shell[SHSIZE]) {
u.u_error = ENOEXEC;
goto bad;
}