summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2007-09-24 15:57:09 +0000
committerotto <otto@openbsd.org>2007-09-24 15:57:09 +0000
commit6dd494c5b47f0569656c4f76e58bf7ddbc9855ad (patch)
tree80eb819f1097d5950207edf353a2518e1c72cbb9
parentunused vars (diff)
downloadwireguard-openbsd-6dd494c5b47f0569656c4f76e58bf7ddbc9855ad.tar.xz
wireguard-openbsd-6dd494c5b47f0569656c4f76e58bf7ddbc9855ad.zip
from ragge's repo:
Fix init error to give an error message instead of segfault, as reported by Otto Muerbeek.
-rw-r--r--usr.bin/pcc/cc/ccom/init.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/pcc/cc/ccom/init.c b/usr.bin/pcc/cc/ccom/init.c
index 32938dbc2c4..ed4a6ba1a92 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.4 2007/09/23 18:34:38 otto Exp $ */
+/* $OpenBSD: init.c,v 1.5 2007/09/24 15:57:09 otto Exp $ */
/*
* Copyright (c) 2004, 2007 Anders Magnusson (ragge@ludd.ltu.se).
@@ -282,10 +282,14 @@ stkpush(void)
is->in_df = sp->sdf;
} else if (ISSOU(t)) {
sq = *pstk->in_xp;
- is->in_xp = ISSOU(sq->stype) ? sq->ssue->suelem : 0;
- is->in_t = sq->stype;
- is->in_sym = sq;
- is->in_df = sq->sdf;
+ if (sq == NULL) {
+ uerror("excess of initializing elements");
+ } else {
+ is->in_xp = ISSOU(sq->stype) ? sq->ssue->suelem : 0;
+ is->in_t = sq->stype;
+ is->in_sym = sq;
+ is->in_df = sq->sdf;
+ }
} else if (ISARY(t)) {
is->in_xp = ISSOU(DECREF(t)) ? pstk->in_sym->ssue->suelem : 0;
is->in_t = DECREF(t);