From 9102ff44839e51594a4cf2a6e2fe087e9e556422 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 1 Jun 2009 18:20:34 +0000 Subject: "let --" was crashing ksh; found by phy0@rambler.ru. Various other expressions involving ++ and -- also ran into this. Insufficient checks for end of parse in the tokenizer made it assume that an lvalue had been found ok millert otto --- bin/ksh/expr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/ksh/expr.c b/bin/ksh/expr.c index 4ee87318073..13474fda656 100644 --- a/bin/ksh/expr.c +++ b/bin/ksh/expr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expr.c,v 1.19 2006/04/10 14:38:59 jaredy Exp $ */ +/* $OpenBSD: expr.c,v 1.20 2009/06/01 18:20:33 deraadt Exp $ */ /* * Korn expression evaluation @@ -541,7 +541,7 @@ do_ppmm(Expr_state *es, enum token op, struct tbl *vasn, bool is_prefix) static void assign_check(Expr_state *es, enum token op, struct tbl *vasn) { - if (vasn->name[0] == '\0' && !(vasn->flag & EXPRLVALUE)) + if (es->tok == END || (vasn->name[0] == '\0' && !(vasn->flag & EXPRLVALUE))) evalerr(es, ET_LVALUE, opinfo[(int) op].name); else if (vasn->flag & RDONLY) evalerr(es, ET_RDONLY, opinfo[(int) op].name); -- cgit v1.2.3