summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-01 18:20:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-01 18:20:34 +0000
commit9102ff44839e51594a4cf2a6e2fe087e9e556422 (patch)
tree51cbd0c18fe66e16e159be844ec137f4e517806c
parent603e6ed09c643c92ce4e3b83cd590e9c8f84ece0 (diff)
"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
-rw-r--r--bin/ksh/expr.c4
1 files changed, 2 insertions, 2 deletions
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);