summaryrefslogtreecommitdiff
path: root/usr.bin/pcc/cc/ccom/init.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-09-29 13:57:15 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-09-29 13:57:15 +0000
commit480f53ea5cd00520a87c15a17d9a407aae570dce (patch)
treee6a95809bd8ed76bf506265abe551e653e99a832 /usr.bin/pcc/cc/ccom/init.c
parent4297cd8c6b7a9553c15e0737cd65cda6a723d3a9 (diff)
Avoid a member array overflow in the init code; ok ragge@
Diffstat (limited to 'usr.bin/pcc/cc/ccom/init.c')
-rw-r--r--usr.bin/pcc/cc/ccom/init.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/pcc/cc/ccom/init.c b/usr.bin/pcc/cc/ccom/init.c
index 11ed64dbbe4..f8dc543b14c 100644
--- a/usr.bin/pcc/cc/ccom/init.c
+++ b/usr.bin/pcc/cc/ccom/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.6 2007/09/25 05:51:44 otto Exp $ */
+/* $OpenBSD: init.c,v 1.7 2007/09/29 13:57:14 otto Exp $ */
/*
* Copyright (c) 2004, 2007 Anders Magnusson (ragge@ludd.ltu.se).
@@ -327,7 +327,7 @@ stkpop(void)
printf("stkpop\n");
#endif
for (; pstk; pstk = pstk->in_prev) {
- if (pstk->in_t == STRTY) {
+ if (pstk->in_t == STRTY && pstk->in_xp[0] != NULL) {
pstk->in_xp++;
if (*pstk->in_xp != NULL)
break;
@@ -732,7 +732,7 @@ irbrace()
if (ISARY(pstk->in_t))
pstk->in_n = pstk->in_df->ddim;
else if (pstk->in_t == STRTY) {
- while (pstk->in_xp[1] != NULL)
+ while (pstk->in_xp[0] != NULL && pstk->in_xp[1] != NULL)
pstk->in_xp++;
}
stkpop();