[MPlayer-dev-eng] [PATCH] fix "Unknown argument" with cmd containing spaces
Aurelien Jacobs
aurel at gnuage.org
Fri Feb 11 12:42:38 CET 2005
On Wed, 9 Feb 2005 19:24:57 +0100
Aurelien Jacobs <aurel at gnuage.org> wrote:
> Hi,
>
> I've just found a bug in mp_input_parse_cmd.
> First an example (silly but simple enough to show the bug).
> Trying to parse :
> run 'ls -l'
> will display :
> Unknown argument 1
> But the command is still executed correctly.
>
> When a string arg begin with a ' or a ", the parser read it up
> to the closing ' or ". But after reading an argument, the parser
> try to find the next one by searching for a space in the string,
> begining at the START of last argument.
> So with my example, the parser will first extract the command (run)
> and then will parse the following string :
> 'ls -l'
> It will then set arg[0] = "ls -l" and will search for the next space
> character. So it will then try to parse this string :
> -l'
> Which is what causes the "Unknown argument 1".
>
> This patch simply set ptr to the end of the parsed argument when
> when encounter a quoted string, so we can't step on a space inside
> this string.
Commited.
Aurel
More information about the MPlayer-dev-eng
mailing list