diff options
author | Brian Foley <bpfoley@google.com> | 2016-10-15 14:45:40 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-24 02:09:56 +0200 |
commit | 61d5997b586a28f79d54b28ce6963b643dff6e9e (patch) | |
tree | 161fb8911ed9a5bda79d1a1f8ac34534aae40564 /editors | |
parent | 1336052a490ffe7a3790ee3c1366756ca8a7f5ca (diff) | |
download | busybox-w32-61d5997b586a28f79d54b28ce6963b643dff6e9e.tar.gz busybox-w32-61d5997b586a28f79d54b28ce6963b643dff6e9e.tar.bz2 busybox-w32-61d5997b586a28f79d54b28ce6963b643dff6e9e.zip |
awk: fix segfault on for loop syntax error
Parsing "for()" segfaults as awk fails to find loop iteration expressions.
Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r-- | editors/awk.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/editors/awk.c b/editors/awk.c index d0269b9f4..685e8bed8 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -1514,7 +1514,7 @@ static void chain_group(void) | |||
1514 | next_token(TC_SEQSTART); | 1514 | next_token(TC_SEQSTART); |
1515 | n2 = parse_expr(TC_SEMICOL | TC_SEQTERM); | 1515 | n2 = parse_expr(TC_SEMICOL | TC_SEQTERM); |
1516 | if (t_tclass & TC_SEQTERM) { /* for-in */ | 1516 | if (t_tclass & TC_SEQTERM) { /* for-in */ |
1517 | if ((n2->info & OPCLSMASK) != OC_IN) | 1517 | if (!n2 || (n2->info & OPCLSMASK) != OC_IN) |
1518 | syntax_error(EMSG_UNEXP_TOKEN); | 1518 | syntax_error(EMSG_UNEXP_TOKEN); |
1519 | n = chain_node(OC_WALKINIT | VV); | 1519 | n = chain_node(OC_WALKINIT | VV); |
1520 | n->l.n = n2->l.n; | 1520 | n->l.n = n2->l.n; |