Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!sri-spam!mordor!lll-tis!elxsi!marduk!gww From: gww@marduk.UUCP (Gary Winiger) Newsgroups: comp.bugs.4bsd Subject: execve(2) doesn't report ENOEXEC if ``#!'' line is too long. +Fix Message-ID: <518@elxsi.UUCP> Date: Fri, 4-Sep-87 18:11:46 EDT Article-I.D.: elxsi.518 Posted: Fri Sep 4 18:11:46 1987 Date-Received: Sat, 5-Sep-87 21:25:45 EDT Sender: nobody@elxsi.UUCP Reply-To: gww@marduk.UUCP (Gary Winiger) Organization: ELXSI Super Computers, San Jose Lines: 53 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; }