summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/execve.2
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2010-09-21 16:24:51 +0000
committeralc <alc@FreeBSD.org>2010-09-21 16:24:51 +0000
commit524cb00f17e42971cf96e8296f984f02cb0fa592 (patch)
tree678f632332f49df72469a35d01eac0912c8bef7b /lib/libc/sys/execve.2
parentfe208ba09513af099f5dc6f4602814ccba69a10e (diff)
downloadFreeBSD-src-524cb00f17e42971cf96e8296f984f02cb0fa592.zip
FreeBSD-src-524cb00f17e42971cf96e8296f984f02cb0fa592.tar.gz
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
Diffstat (limited to 'lib/libc/sys/execve.2')
-rw-r--r--lib/libc/sys/execve.210
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libc/sys/execve.2 b/lib/libc/sys/execve.2
index 0559a1a..991495c 100644
--- a/lib/libc/sys/execve.2
+++ b/lib/libc/sys/execve.2
@@ -28,7 +28,7 @@
.\" @(#)execve.2 8.5 (Berkeley) 6/1/94
.\" $FreeBSD$
.\"
-.Dd April 10, 2008
+.Dd September 21, 2010
.Dt EXECVE 2
.Os
.Sh NAME
@@ -256,9 +256,11 @@ A component of the path prefix is not a directory.
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded 255 characters,
or an entire path name exceeded 1023 characters.
-.It Bq Er ENAMETOOLONG
-When invoking an interpreted script, the interpreter name
-exceeds
+.It Bq Er ENOEXEC
+When invoking an interpreted script, the length of the first line,
+inclusive of the
+.Sy \&#!
+prefix and terminating newline, exceeds
.Dv MAXSHELLCMDLEN
characters.
.It Bq Er ENOENT
OpenPOWER on IntegriCloud