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
This commit is contained in:
John W. De Boskey 2001-11-28 03:26:58 +00:00
parent 023a0e6100
commit a5f75648d8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=87025
3 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 */