From ea41a8cc5f0b6af81a6f447e066339ed877a455c Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Thu, 4 Mar 2004 07:38:50 +0000 Subject: - Fixed segfault due to missing check for variable declaration. - Added check for multidimensional array usage. --- src/interfaces/ecpg/preproc/variable.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/interfaces/ecpg/preproc/variable.c') diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c index e12b9434998..f1a875f0ccc 100644 --- a/src/interfaces/ecpg/preproc/variable.c +++ b/src/interfaces/ecpg/preproc/variable.c @@ -218,7 +218,7 @@ find_variable(char *name) { /* * We don't care about what's inside the array braces so just - * eat up the character + * eat up the characters */ for (count = 1, end = next + 1; count; end++) { @@ -242,6 +242,11 @@ find_variable(char *name) *next = '\0'; p = find_simple(name); + if (p == NULL) + { + snprintf(errortext, sizeof(errortext), "The variable %s is not declared", name); + mmerror(PARSE_ERROR, ET_FATAL, errortext); + } *next = c; switch (p->type->u.element->type) { -- cgit v1.2.3