[PATCH 1/2] ash: consider "local -" case while iterating over local variables in mklocal.

Denys Vlasenko vda.linux at googlemail.com
Wed May 13 00:10:30 UTC 2015


Applied, thanks!

On Sun, Apr 26, 2015 at 11:32 PM, Eugene Rudoy <gene.devel at gmail.com> wrote:
> fixes segfault introduced in 0a0acb55db8d7c4dec445573f1b0528d126b9e1f with functions using "local -".
> test-case: f() { local -; local x; }; f
>
> note: with this change applied multiple 'local -'s still cause multiple entries to be added to the localvars list.
> this problem will be addressed in a separate commit.
>
> Signed-off-by: Eugene Rudoy <gene.devel at gmail.com>
> ---
>  shell/ash.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/shell/ash.c b/shell/ash.c
> index c51fb80..3e9997b 100644
> --- a/shell/ash.c
> +++ b/shell/ash.c
> @@ -8979,7 +8979,7 @@ mklocal(char *name)
>          */
>         lvp = localvars;
>         while (lvp) {
> -               if (varcmp(lvp->vp->var_text, name) == 0) {
> +               if (lvp->vp && varcmp(lvp->vp->var_text, name) == 0) {
>                         if (eq)
>                                 setvareq(name, 0);
>                         /* else:
> --
> 2.3.6
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list