summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorperry <perry@NetBSD.org>2003-04-02 00:58:56 +0000
committerperry <perry@NetBSD.org>2003-04-02 00:58:56 +0000
commita6e07c4e35d2ff754789553cf4be97e4c9568d1d (patch)
treeffb40d10baa4f8bd4569a71fc2b3b147604182f1
parent71cdc2eb5e03474b6f5914f7e6771758768a1eb2 (diff)
grow #! line length -- patch from cgd, fixes PR kern/20112 from Todd Vierling
-rw-r--r--sys/kern/exec_conf.c6
-rw-r--r--sys/kern/exec_script.c6
-rw-r--r--sys/sys/exec_script.h5
-rw-r--r--sys/sys/param.h4
4 files changed, 12 insertions, 9 deletions
diff --git a/sys/kern/exec_conf.c b/sys/kern/exec_conf.c
index 0d6bc56d649..dc168ee6c6e 100644
--- a/sys/kern/exec_conf.c
+++ b/sys/kern/exec_conf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_conf.c,v 1.79 2003/02/19 09:44:42 jdolecek Exp $ */
+/* $NetBSD: exec_conf.c,v 1.80 2003/04/02 01:00:19 perry Exp $ */
/*
* Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exec_conf.c,v 1.79 2003/02/19 09:44:42 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_conf.c,v 1.80 2003/04/02 01:00:19 perry Exp $");
#include "opt_execfmt.h"
#include "opt_compat_freebsd.h"
@@ -189,7 +189,7 @@ extern const struct emul emul_netbsd_aoutm68k;
const struct execsw execsw_builtin[] = {
#ifdef EXEC_SCRIPT
/* Shell scripts */
- { MAXINTERP,
+ { SCRIPT_HDR_SIZE,
exec_script_makecmds,
{ NULL },
NULL,
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c
index 133fc027e26..521cbf969fb 100644
--- a/sys/kern/exec_script.c
+++ b/sys/kern/exec_script.c
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_script.c,v 1.32 2002/10/29 12:31:23 blymn Exp $ */
+/* $NetBSD: exec_script.c,v 1.33 2003/04/02 01:00:20 perry Exp $ */
/*
* Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.32 2002/10/29 12:31:23 blymn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.33 2003/04/02 01:00:20 perry Exp $");
#if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
#define FDSCRIPTS /* Need this for safe set-id scripts. */
@@ -96,7 +96,7 @@ exec_script_makecmds(struct proc *p, struct exec_package *epp)
* (The latter requirement means that we have to check
* for both spaces and tabs later on.)
*/
- hdrlinelen = min(epp->ep_hdrvalid, MAXINTERP);
+ hdrlinelen = min(epp->ep_hdrvalid, SCRIPT_HDR_SIZE);
for (cp = hdrstr + EXEC_SCRIPT_MAGICLEN; cp < hdrstr + hdrlinelen;
cp++) {
if (*cp == '\n') {
diff --git a/sys/sys/exec_script.h b/sys/sys/exec_script.h
index 720ce5a61f8..7d2ebb00cde 100644
--- a/sys/sys/exec_script.h
+++ b/sys/sys/exec_script.h
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_script.h,v 1.7 1997/01/22 07:09:15 mikel Exp $ */
+/* $NetBSD: exec_script.h,v 1.8 2003/04/02 00:58:56 perry Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@@ -36,6 +36,9 @@
#define EXEC_SCRIPT_MAGIC "#!"
#define EXEC_SCRIPT_MAGICLEN 2
+/* Extra 2 are for possible space between #! and shell name, and newline. */
+#define SCRIPT_HDR_SIZE (EXEC_SCRIPT_MAGICLEN + MAXINTERP + 2)
+
#ifdef _KERNEL
/* the shell script handler's entry in the exec switch */
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 415aaa0991a..93b83d2a347 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.162 2003/03/19 11:57:04 dsl Exp $ */
+/* $NetBSD: param.h,v 1.163 2003/04/02 00:58:56 perry Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -100,7 +100,7 @@
#include <sys/syslimits.h>
#define MAXCOMLEN 16 /* max command name remembered */
-#define MAXINTERP 64 /* max interpreter file name length */
+#define MAXINTERP PATH_MAX /* max interpreter file name length */
/* DEPRECATED: use LOGIN_NAME_MAX instead. */
#define MAXLOGNAME (LOGIN_NAME_MAX - 1) /* max login name length */
#define NCARGS ARG_MAX /* max bytes for an exec function */