On Tuesday 24 August 2010 06:01, Carmelo AMOROSO wrote:
> If there are some spaces in the insmod command line, then
> this will be splitted in single words as separate elements of
> argv. It just needs to chain them together in the options string
> passed to the sys_init_module syscall.
> 
> Signed-off-by: Carmelo Amoroso <[email protected]>
> ---
>  modutils/modutils.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/modutils/modutils.c b/modutils/modutils.c
> index 2608182..cc718db 100644
> --- a/modutils/modutils.c
> +++ b/modutils/modutils.c
> @@ -71,8 +71,7 @@ char* FAST_FUNC parse_cmdline_module_options(char **argv)
>       optlen = 0;
>       while (*++argv) {
>               options = xrealloc(options, optlen + 2 + strlen(*argv) + 2);
> -             /* Spaces handled by "" pairs, but no way of escaping quotes */
> -             optlen += sprintf(options + optlen, (strchr(*argv, ' ') ? 
> "\"%s\" " : "%s "), *argv);
> +             optlen += sprintf(options + optlen, "%s ", *argv);
>       }
>       return options;
>  }


Houston, we have a problem:

On Tuesday 01 February 2011 23:25, Denys Vlasenko wrote:
> On Tuesday 01 February 2011 19:48, Ralf Friedl wrote:
> > Hi
> > 
> > The commit 
> > http://git.buildroot.org/busybox/commit/?id=1396221d5a741ef8e1e8abca88836b341a3cab84
> >  
> > breaks modprobe/insmod with spaces inside the parameters.
> > 
> > When calling
> >     modprobe -v iptable_filter forward='1 2'
> > the old version did
> >     init_module(0x499838, 5306, "\"forward=1 2\" ") = 0
> > while the new version does
> >     init_module(0x491838, 5306, "forward=1 2 ") = -1 ENOENT (No such 
> > file or directory)
> > And dmesg says
> >     iptable_filter: Unknown parameter `2'
> > 
> > The kernel considers the '2' after the space to be the name of another 
> > parameter and not part of the value of forward. From the comments, this 
> > change seems intentional, but I don't see any advantage of this patch. 
> > Actually it seems obvious that the kernel can't recognize parameters 
> > with spaces after this patch.
> > If it's just about code size, using the quotes always should also be 
> > possible.
> 
> Hmm. You are right. Reverting.
> 
> But even old behavior wasn't exactly correct. It was doing:
> 
> init_module(0x8c8e1b8, 4744, "\"forward=1 2\" ") = -1 ENOENT (No such file or 
> directory)
> 
> 
> whereas module-init-tools version 3.11.1 does:
> 
> init_module(0xf6eab0, 4744, "forward=\"1 2\"") = -1 ENOENT (No such file or 
> directory)
> 
> See? qoutes should be around value only.

-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to