summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-05-05 06:46:18 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-05-05 06:46:18 +0000
commit2dd58aa59eae1f3a75d32a24264fc1ce253d10d8 (patch)
tree3c5c31b2f96766ece7f4a848bb9851b1b6953976
parentd4adead0174b4b8499af66a741b958d20035610a (diff)
Fix SEGV on scalar initialization with braces; also found in NetBSD
rev 1.23 as part of a much larger diff. ok cloder@
-rw-r--r--usr.bin/xlint/lint1/init.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/xlint/lint1/init.c b/usr.bin/xlint/lint1/init.c
index 068c1d7d719..65d77f823c2 100644
--- a/usr.bin/xlint/lint1/init.c
+++ b/usr.bin/xlint/lint1/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.8 2006/04/18 02:59:40 cloder Exp $ */
+/* $OpenBSD: init.c,v 1.9 2006/05/05 06:46:17 otto Exp $ */
/* $NetBSD: init.c,v 1.4 1995/10/02 17:21:37 jpo Exp $ */
/*
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: init.c,v 1.8 2006/04/18 02:59:40 cloder Exp $";
+static char rcsid[] = "$OpenBSD: init.c,v 1.9 2006/05/05 06:46:17 otto Exp $";
#endif
#include <stdlib.h>
@@ -461,7 +461,7 @@ strginit(tnode_t *tn)
* Check if we have an array type which can be initialized by
* the string.
*/
- if (istk->i_subt->t_tspec == ARRAY) {
+ if (istk->i_subt != NULL && istk->i_subt->t_tspec == ARRAY) {
t = istk->i_subt->t_subt->t_tspec;
if (!((strg->st_tspec == CHAR &&
(t == CHAR || t == UCHAR || t == SCHAR)) ||