diff -u -r linux/fs/binfmt_elf.c linux~/fs/binfmt_elf.c --- linux/fs/binfmt_elf.c Wed Jul 19 02:26:55 2000 +++ linux~/fs/binfmt_elf.c Sat Jul 29 17:28:56 2000 @@ -512,7 +512,7 @@ retval = PTR_ERR(interpreter); if (IS_ERR(interpreter)) goto out_free_interp; - retval = kernel_read(interpreter, 0, bprm->buf, 128); + retval = kernel_read(interpreter, 0, bprm->buf, BINPRM_BUF_SIZE); if (retval < 0) goto out_free_dentry; diff -u -r linux/fs/binfmt_misc.c linux~/fs/binfmt_misc.c --- linux/fs/binfmt_misc.c Mon Jun 26 14:36:44 2000 +++ linux~/fs/binfmt_misc.c Sat Jul 29 17:28:56 2000 @@ -182,7 +182,7 @@ { struct binfmt_entry *fmt; struct file * file; - char iname[128]; + char iname[BINPRM_BUF_SIZE]; char *iname_addr = iname; int retval; @@ -194,8 +194,8 @@ read_lock(&entries_lock); fmt = check_file(bprm); if (fmt) { - strncpy(iname, fmt->interpreter, 127); - iname[127] = '\0'; + strncpy(iname, fmt->interpreter, BINPRM_BUF_SIZE - 1); + iname[BINPRM_BUF_SIZE - 1] = '\0'; } read_unlock(&entries_lock); if (!fmt) @@ -324,7 +324,7 @@ /* more sanity checks */ if (err || !(!cnt || (!(--cnt) && (*sp == '\n'))) || - (e->size < 1) || ((e->size + e->offset) > 127) || + (e->size < 1) || ((e->size + e->offset) > (BINPRM_BUF_SIZE - 1)) || !(e->proc_name) || !(e->interpreter) || entry_proc_setup(e)) goto free_err; diff -u -r linux/fs/binfmt_script.c linux~/fs/binfmt_script.c --- linux/fs/binfmt_script.c Mon Jun 26 14:36:44 2000 +++ linux~/fs/binfmt_script.c Sat Jul 29 17:28:56 2000 @@ -18,7 +18,7 @@ { char *cp, *i_name, *i_arg; struct file *file; - char interp[128]; + char interp[BINPRM_BUF_SIZE]; int retval; if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || (bprm->sh_bang)) @@ -33,9 +33,9 @@ fput(bprm->file); bprm->file = NULL; - bprm->buf[127] = '\0'; + bprm->buf[BINPRM_BUF_SIZE - 1] = '\0'; if ((cp = strchr(bprm->buf, '\n')) == NULL) - cp = bprm->buf+127; + cp = bprm->buf+BINPRM_BUF_SIZE-1; *cp = '\0'; while (cp > bprm->buf) { cp--; diff -u -r linux/fs/exec.c linux~/fs/exec.c --- linux/fs/exec.c Wed Jul 5 14:31:01 2000 +++ linux~/fs/exec.c Sat Jul 29 17:27:06 2000 @@ -555,7 +555,7 @@ /* * Fill the binprm structure from the inode. - * Check permissions, then read the first 512 bytes + * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes */ int prepare_binprm(struct linux_binprm *bprm) { @@ -646,8 +646,8 @@ } } - memset(bprm->buf,0,sizeof(bprm->buf)); - return kernel_read(bprm->file,0,bprm->buf,128); + memset(bprm->buf,0,BINPRM_BUF_SIZE); + return kernel_read(bprm->file,0,bprm->buf,BINPRM_BUF_SIZE); } /* @@ -819,14 +819,14 @@ int retval; int i; - bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); - memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0])); - file = open_exec(filename); retval = PTR_ERR(file); if (IS_ERR(file)) return retval; + + bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); + memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0])); bprm.file = file; bprm.filename = filename; diff -u -r linux/include/linux/binfmts.h linux~/include/linux/binfmts.h --- linux/include/linux/binfmts.h Thu Jul 27 23:13:22 2000 +++ linux~/include/linux/binfmts.h Sat Jul 29 17:04:03 2000 @@ -11,13 +11,16 @@ */ #define MAX_ARG_PAGES 32 +/* sizeof(linux_binprm->buf) */ +#define BINPRM_BUF_SIZE 128 + #ifdef __KERNEL__ /* * This structure is used to hold the arguments that are used when loading binaries. */ struct linux_binprm{ - char buf[128]; + char buf[BINPRM_BUF_SIZE]; struct page *page[MAX_ARG_PAGES]; unsigned long p; /* current top of mem */ int sh_bang; diff -u linux/CREDITS linux~/CREDITS --- linux/CREDITS Wed Jul 26 13:38:23 2000 +++ linux~/CREDITS Sat Jul 29 17:43:00 2000 @@ -1556,6 +1556,12 @@ S: Niwot, Colorado 80503 S: USA +N: Robert M. Love +E: rml@tech9.net +E: rml@ufl.edu +D: misc. kernel hacking and debugging +S: FL, USA + N: Martin von Löwis E: loewis@informatik.hu-berlin.de D: script binary format