diff options
author | Michael Meskes <meskes@postgresql.org> | 2004-03-04 07:32:02 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2004-03-04 07:32:02 +0000 |
commit | f3c6d592d21b81e60f6a2358c68bc527d49302f7 (patch) | |
tree | 38cb2ea9fd62046bba955cdfb54eea350fd9f52e /src/interfaces/ecpg/preproc/variable.c | |
parent | c934cf1e962d79eaa70b99739bb325b429d31a77 (diff) | |
download | postgresql-f3c6d592d21b81e60f6a2358c68bc527d49302f7.tar.gz postgresql-f3c6d592d21b81e60f6a2358c68bc527d49302f7.zip |
- Fixed segfault due to missing check for variable declaration.
- Added check for multidimensional array usage.
Diffstat (limited to 'src/interfaces/ecpg/preproc/variable.c')
-rw-r--r-- | src/interfaces/ecpg/preproc/variable.c | 7 |
1 files changed, 6 insertions, 1 deletions
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) { |