aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-26 19:25:40 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-26 20:33:51 +0200
commitd5b500c81c1ec73d2feeea14c2e872726044d9e8 (patch)
tree8d0164c544655b35ccac48cc140b03d35772d1e5 /shell
parentb8ab27bf53797ec98c7c7d1c80a5a0a062f273a5 (diff)
downloadbusybox-d5b500c81c1ec73d2feeea14c2e872726044d9e8.tar.gz
ash: [VAR] Fix poplocalvar leak
Upstream commit: Date: Tue, 25 May 2010 18:14:32 +0800 [VAR] Fix poplocalvar leak When a variable is marked as local, we set VSTRFIXED on its vp recored. However, poplocalvar never clears this flag for variables that were unset to begin with. Thus if you ever made an unset variable local, it would get the VSTRFIXED bit and stick around forever. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 8bef78546..75a72ea0c 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9200,7 +9200,8 @@ poplocalvars(void)
memcpy(optlist, lvp->text, sizeof(optlist));
free((char*)lvp->text);
optschanged();
- } else if ((lvp->flags & (VUNSET|VSTRFIXED)) == VUNSET) {
+ } else if (lvp->flags == VUNSET) {
+ vp->flags &= ~(VSTRFIXED|VREADONLY);
unsetvar(vp->var_text);
} else {
if (vp->var_func)