diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-20 23:03:23 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-20 23:03:23 +0000 |
commit | 7ae1cc16b4ecec930cd776f9ed688b6d4d53a166 (patch) | |
tree | dea5f9edc2fabb62c126930df82e7e1b4d443b73 /shell/msh.c | |
parent | 2b68c8f74420c08ff3bb44d6745833ea715b6590 (diff) | |
download | busybox-w32-7ae1cc16b4ecec930cd776f9ed688b6d4d53a166.tar.gz busybox-w32-7ae1cc16b4ecec930cd776f9ed688b6d4d53a166.tar.bz2 busybox-w32-7ae1cc16b4ecec930cd776f9ed688b6d4d53a166.zip |
msh: fix "while...continue" bug 3884.
Diffstat (limited to 'shell/msh.c')
-rw-r--r-- | shell/msh.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/shell/msh.c b/shell/msh.c index 44213c657..eb17eb668 100644 --- a/shell/msh.c +++ b/shell/msh.c | |||
@@ -2573,6 +2573,10 @@ static int execute(struct op *t, int *pin, int *pout, int no_fork) | |||
2573 | while (setjmp(bc.brkpt)) | 2573 | while (setjmp(bc.brkpt)) |
2574 | if (isbreak) | 2574 | if (isbreak) |
2575 | goto broken; | 2575 | goto broken; |
2576 | /* Restore areanum value. It may be incremented by execute() | ||
2577 | * below, and then "continue" may jump back to setjmp above */ | ||
2578 | areanum = a + 1; | ||
2579 | freearea(areanum + 1); | ||
2576 | brkset(&bc); | 2580 | brkset(&bc); |
2577 | for (t1 = t->left; i-- && *wp != NULL;) { | 2581 | for (t1 = t->left; i-- && *wp != NULL;) { |
2578 | setval(vp, *wp++); | 2582 | setval(vp, *wp++); |
@@ -2586,6 +2590,10 @@ static int execute(struct op *t, int *pin, int *pout, int no_fork) | |||
2586 | while (setjmp(bc.brkpt)) | 2590 | while (setjmp(bc.brkpt)) |
2587 | if (isbreak) | 2591 | if (isbreak) |
2588 | goto broken; | 2592 | goto broken; |
2593 | /* Restore areanum value. It may be incremented by execute() | ||
2594 | * below, and then "continue" may jump back to setjmp above */ | ||
2595 | areanum = a + 1; | ||
2596 | freearea(areanum + 1); | ||
2589 | brkset(&bc); | 2597 | brkset(&bc); |
2590 | t1 = t->left; | 2598 | t1 = t->left; |
2591 | while ((execute(t1, pin, pout, /* no_fork: */ 0) == 0) == (t->op_type == TWHILE)) | 2599 | while ((execute(t1, pin, pout, /* no_fork: */ 0) == 0) == (t->op_type == TWHILE)) |