[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH 3/5] ash: fix command -- crash
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2015-10-29 18:48:24
Message-ID: CAK1hOcNLpYLweW67PPJu7+nirCWaypbNsPdJFVQtpsZBiVF0hA () mail ! gmail ! com
[Download RAW message or body]
On Mon, Aug 3, 2015 at 2:46 PM, Ron Yorston <rmy@pobox.com> wrote:
> busybox sh -c 'command --' segfaults because parse_command_args
> returns a pointer to a null pointer.
>
> Based on commit 18071c7 from git://git.kernel.org/pub/scm/utils/dash/dash.git
> by Gerrit Pape.
>
> function old new delta
> evalcommand 1368 1350 -18
> ------------------------------------------------------------------------------
> (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-18) Total: -18 bytes
>
> Signed-off-by: Ron Yorston <rmy@pobox.com>
> ---
> shell/ash.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/shell/ash.c b/shell/ash.c
> index 7f3808b..ddcd28b 100644
> --- a/shell/ash.c
> +++ b/shell/ash.c
> @@ -8885,8 +8885,8 @@ parse_command_args(char **argv, const char **path)
> if (!c)
> break;
> if (c == '-' && !*cp) {
> - argv++;
> - break;
> + if (!*++argv)
> + return 0;
You lost "break".
Now -- doesn't work:
sh -c 'command -- -p'
now parses -p as an option.
Applied with some edits. Thanks!
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic