From owner-cvs-src-old@FreeBSD.ORG Tue Sep 21 16:26:05 2010 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9CB91065672 for ; Tue, 21 Sep 2010 16:26:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 971568FC1C for ; Tue, 21 Sep 2010 16:26:05 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.4/8.14.4) with ESMTP id o8LGQ5Jl022051 for ; Tue, 21 Sep 2010 16:26:05 GMT (envelope-from alc@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.4/8.14.4/Submit) id o8LGQ5VF022050 for cvs-src-old@freebsd.org; Tue, 21 Sep 2010 16:26:05 GMT (envelope-from alc@repoman.freebsd.org) Message-Id: <201009211626.o8LGQ5VF022050@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to alc@repoman.freebsd.org using -f From: Alan Cox Date: Tue, 21 Sep 2010 16:24:51 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/lib/libc/sys execve.2 src/sys/kern imgact_shell.c src/sys/sys param.h X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2010 16:26:05 -0000 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