From: Eugene Rudoy Date: Sun, 26 Apr 2015 21:32:00 +0000 (+0200) Subject: ash: consider "local -" case while iterating over local variables in mklocal. X-Git-Tag: 1_24_0~127 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1285aa62f914ba894b82880e57bd81cfbc41f180;p=oweals%2Fbusybox.git ash: consider "local -" case while iterating over local variables in mklocal. 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 Signed-off-by: Denys Vlasenko --- diff --git a/shell/ash.c b/shell/ash.c index c51fb804d..3e9997b53 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: