diff options
author | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-02-25 11:49:42 +0000 |
---|---|---|
committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2005-02-25 11:49:42 +0000 |
commit | 90dc539be0c5664c0700384027260e7ed60f3c4e (patch) | |
tree | 850254d8b3919e971cf675fe4ef7719a364188cd /sys/kern/kern_exec.c | |
parent | 88bf82a62e264debd5ccd4baad996442cf9a7d6b (diff) | |
download | src-90dc539be0c5664c0700384027260e7ed60f3c4e.tar.gz src-90dc539be0c5664c0700384027260e7ed60f3c4e.zip |
Welcome to the 21st century: increase MAXSHELLCMDLEN from 128 bytes to
PAGE_SIZE.
Unlike originator of the PR suggests retain MAXSHELLCMDLEN definition
(he has been proposing to replace it with PAGE_SIZE everywhere), not only
this reduced the diff significantly, but prevents code obfuscation and also
allows to increase/decrease this parameter easily if needed.
PR: kern/64196
Submitted by: Magnus Bäckström <b@etek.chalmers.se>
Notes
Notes:
svn path=/head/; revision=142453
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r-- | sys/kern/kern_exec.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 98b52eaa9a17..7a15f754b374 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -320,7 +320,7 @@ do_execve(td, args, mac_p) imgp->entry_addr = 0; imgp->vmspace_destroyed = 0; imgp->interpreted = 0; - imgp->interpreter_name[0] = '\0'; + imgp->interpreter_name = args->buf + PATH_MAX + ARG_MAX; imgp->auxargs = NULL; imgp->vp = NULL; imgp->object = NULL; @@ -931,9 +931,13 @@ exec_copyin_args(struct image_args *args, char *fname, return (EFAULT); /* * Allocate temporary demand zeroed space for argument and - * environment strings + * environment strings: + * + * o ARG_MAX for argument and environment; + * o MAXSHELLCMDLEN for the name of interpreters. */ - args->buf = (char *) kmem_alloc_wait(exec_map, PATH_MAX + ARG_MAX); + args->buf = (char *) kmem_alloc_wait(exec_map, + PATH_MAX + ARG_MAX + MAXSHELLCMDLEN); if (args->buf == NULL) return (ENOMEM); args->begin_argv = args->buf; @@ -997,8 +1001,8 @@ exec_free_args(struct image_args *args) { if (args->buf) { - kmem_free_wakeup(exec_map, - (vm_offset_t)args->buf, PATH_MAX + ARG_MAX); + kmem_free_wakeup(exec_map, (vm_offset_t)args->buf, + PATH_MAX + ARG_MAX + MAXSHELLCMDLEN); args->buf = NULL; } } |