summaryrefslogtreecommitdiff
path: root/usr.bin/yacc/reader.c
diff options
context:
space:
mode:
authorChad Loder <cloder@cvs.openbsd.org>2006-04-20 04:22:11 +0000
committerChad Loder <cloder@cvs.openbsd.org>2006-04-20 04:22:11 +0000
commit2c2b86fa0b50b60eb407054dafe48f578323d588 (patch)
treefe12b784b1e9c31d5e1d72d4d83c90d43de15377 /usr.bin/yacc/reader.c
parent92c27456c3dd43c210e53ed198574cb2b7a4607a (diff)
Fix off-by-one read caused by bad grammars. I think this defect was
present in the very first version of byacc from the early 90's and was only triggered recently when I used malloc.conf -> JG on a bad gramamr. OK millert@
Diffstat (limited to 'usr.bin/yacc/reader.c')
-rw-r--r--usr.bin/yacc/reader.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c
index e9c9c5ab745..cd871dd2797 100644
--- a/usr.bin/yacc/reader.c
+++ b/usr.bin/yacc/reader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: reader.c,v 1.18 2005/06/10 16:40:45 pvalchev Exp $ */
+/* $OpenBSD: reader.c,v 1.19 2006/04/20 04:22:10 cloder Exp $ */
/* $NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $ */
/*
@@ -1250,7 +1250,7 @@ end_rule(void)
if (!last_was_action && plhs[nrules]->tag)
{
for (i = nitems - 1; pitem[i]; --i) continue;
- if (pitem[i+1] == 0 || pitem[i+1]->tag != plhs[nrules]->tag)
+ if (pitem[i] == 0 || pitem[i]->tag != plhs[nrules]->tag)
default_action_warning();
}