From 61d5997b586a28f79d54b28ce6963b643dff6e9e Mon Sep 17 00:00:00 2001 From: Brian Foley Date: Sat, 15 Oct 2016 14:45:40 +0100 Subject: awk: fix segfault on for loop syntax error Parsing "for()" segfaults as awk fails to find loop iteration expressions. Signed-off-by: Brian Foley Signed-off-by: Denys Vlasenko --- editors/awk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors') 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) next_token(TC_SEQSTART); n2 = parse_expr(TC_SEMICOL | TC_SEQTERM); if (t_tclass & TC_SEQTERM) { /* for-in */ - if ((n2->info & OPCLSMASK) != OC_IN) + if (!n2 || (n2->info & OPCLSMASK) != OC_IN) syntax_error(EMSG_UNEXP_TOKEN); n = chain_node(OC_WALKINIT | VV); n->l.n = n2->l.n; -- cgit v1.2.3