summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwd <jwd@FreeBSD.org>2001-11-28 03:26:58 +0000
committerjwd <jwd@FreeBSD.org>2001-11-28 03:26:58 +0000
commit2a6f1a68f9a37cfcb5a656dc1e4220b5cb3686bd (patch)
tree2d7cb338d9de6526161b14c0d81b2bd15578a3c6
parentca5b2bc739a0ba228a9c6374dcd9483191fea795 (diff)
downloadFreeBSD-src-2a6f1a68f9a37cfcb5a656dc1e4220b5cb3686bd.zip
FreeBSD-src-2a6f1a68f9a37cfcb5a656dc1e4220b5cb3686bd.tar.gz
Return a more meaningful errno when the length of the interpreter
exceeds MAXSHELLCMDLEN to avoid secondary /bin/sh execution. Update execve man page to reflect change. Increase MAXSHELLCMDLEN to a slightly more meaningful value. PR: kern/32106 Submitted by: b@etek.chalmers.se Reviewed by: bsd MFC after: 2 weeks
-rw-r--r--lib/libc/sys/execve.23
-rw-r--r--sys/kern/imgact_shell.c2
-rw-r--r--sys/sys/imgact.h2
3 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/sys/execve.2 b/lib/libc/sys/execve.2
index 56aefcf..84e9537 100644
--- a/lib/libc/sys/execve.2
+++ b/lib/libc/sys/execve.2
@@ -210,6 +210,9 @@ 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 MAXSHELLCMDLEN characters.
.It Bq Er ENOENT
The new process file does not exist.
.It Bq Er ELOOP
diff --git a/sys/kern/imgact_shell.c b/sys/kern/imgact_shell.c
index a15b56c..8480fcc 100644
--- a/sys/kern/imgact_shell.c
+++ b/sys/kern/imgact_shell.c
@@ -74,7 +74,7 @@ exec_shell_imgact(imgp)
*/
for (ihp = &image_header[2]; *ihp != '\n' && *ihp != '#'; ++ihp) {
if (ihp >= &image_header[MAXSHELLCMDLEN])
- return(ENOEXEC);
+ return(ENAMETOOLONG);
}
line_endp = ihp;
diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h
index c4647c5..b6f67a4 100644
--- a/sys/sys/imgact.h
+++ b/sys/sys/imgact.h
@@ -36,7 +36,7 @@
#ifndef _SYS_IMGACT_H_
#define _SYS_IMGACT_H_
-#define MAXSHELLCMDLEN 64
+#define MAXSHELLCMDLEN 128
struct image_params {
struct proc *proc; /* our process struct */
OpenPOWER on IntegriCloud