lkml.org 
[lkml]   [1996]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: binfmt_script bug in 2.1.12+? [here's a patch]

Boris Tobotras <boris@xtalk.msk.su> writes:

> Since (I believe) 2.1.12 kernel can't run scripts with arguments for
> interpreter. Say exec()ing script with,

My fault. This patch fixes it.

Tom.

--- linux/fs/binfmt_script.c.1 Sun Nov 24 16:19:06 1996
+++ linux/fs/binfmt_script.c Sun Nov 24 16:20:06 1996
@@ -13,7 +13,7 @@

static int do_load_script(struct linux_binprm *bprm,struct pt_regs *regs)
{
- char *cp, *i_name, *i_arg;
+ char *cp, *i_name, *i_name_start, *i_arg;
char interp[128];
int retval;
if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || (bprm->sh_bang))
@@ -39,10 +39,9 @@
break;
}
for (cp = bprm->buf+2; (*cp == ' ') || (*cp == '\t'); cp++);
- if (cp == '\0')
+ if (*cp == '\0')
return -ENOEXEC; /* No interpreter name found */
- strcpy (interp, cp);
- i_name = cp;
+ i_name_start = i_name = cp;
i_arg = 0;
for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++) {
if (*cp == '/')
@@ -52,6 +51,7 @@
*cp++ = '\0';
if (*cp)
i_arg = cp;
+ strcpy (interp, i_name_start);
/*
* OK, we've parsed out the interpreter name and
* (optional) argument.
\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.032 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site