Date: Tue, 21 Sep 2010 16:24:51 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/lib/libc/sys execve.2 src/sys/kern imgact_shell.c src/sys/sys param.h Message-ID: <201009211626.o8LGQ5VF022050@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
alc 2010-09-21 16:24:51 UTC FreeBSD src repository Modified files: lib/libc/sys execve.2 sys/kern imgact_shell.c sys/sys param.h Log: SVN rev 212965 on 2010-09-21 16:24:51Z by alc Fix exec_imgact_shell()'s handling of two error cases: (1) Previously, if the first line of a script exceeded MAXSHELLCMDLEN characters, then exec_imgact_shell() silently truncated the line and passed on the truncated interpreter name or argument. Now, exec_imgact_shell() will fail and return ENOEXEC, which is the commonly used errno among Unix variants for this type of error. (2) Previously, exec_imgact_shell()'s check on the length of the interpreter's name was ineffective. In other words, exec_imgact_shell() could not possibly fail and return ENAMETOOLONG. The reason being that the length of the interpreter name had to exceed MAXSHELLCMDLEN characters in order that ENAMETOOLONG be returned. But, the search for the end of the interpreter name stops after at most MAXSHELLCMDLEN - 2 characters are scanned. (In the end, this particular error is eventually discovered outside of exec_imgact_shell() and ENAMETOOLONG is returned. So, the real effect of this second change is that the error is detected earlier, in exec_imgact_shell().) Update the definition of MAXINTERP to the actual limit on the size of the interpreter name that has been in effect since r142453 (from 2005). In collaboration with: kib Revision Changes Path 1.46 +6 -4 src/lib/libc/sys/execve.2 1.40 +16 -12 src/sys/kern/imgact_shell.c 1.461 +1 -1 src/sys/sys/param.h
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009211626.o8LGQ5VF022050>