aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/variable.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-09-02 06:11:43 +0000
committerBruce Momjian <bruce@momjian.us>2002-09-02 06:11:43 +0000
commita12b4e279bc12a7cd7b7d679fcac4689ac4aba7b (patch)
treeff120ff0c156829d771bdc874fe8fbb2aa4fbf6e /src/interfaces/ecpg/preproc/variable.c
parent48e1a39924d9e0674306156a6519cf5688c67c43 (diff)
downloadpostgresql-a12b4e279bc12a7cd7b7d679fcac4689ac4aba7b.tar.gz
postgresql-a12b4e279bc12a7cd7b7d679fcac4689ac4aba7b.zip
I checked all the previous string handling errors and most of them were
already fixed by You. However there were a few left and attached patch should fix the rest of them. I used StringInfo only in 2 places and both of them are inside debug ifdefs. Only performance penalty will come from using strlen() like all the other code does. I also modified some of the already patched parts by changing snprintf(buf, 2 * BUFSIZE, ... style lines to snprintf(buf, sizeof(buf), ... where buf is an array. Jukka Holappa
Diffstat (limited to 'src/interfaces/ecpg/preproc/variable.c')
-rw-r--r--src/interfaces/ecpg/preproc/variable.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c
index cee7ab3cf50..fd8b7c97943 100644
--- a/src/interfaces/ecpg/preproc/variable.c
+++ b/src/interfaces/ecpg/preproc/variable.c
@@ -80,13 +80,13 @@ find_struct(char *name, char *next)
{
if (p->type->type != ECPGt_array)
{
- sprintf(errortext, "variable %s is not a pointer", name);
+ snprintf(errortext, sizeof(errortext), "variable %s is not a pointer", name);
mmerror(PARSE_ERROR, ET_FATAL, errortext);
}
if (p->type->u.element->type != ECPGt_struct && p->type->u.element->type != ECPGt_union)
{
- sprintf(errortext, "variable %s is not a pointer to a structure or a union", name);
+ snprintf(errortext, sizeof(errortext), "variable %s is not a pointer to a structure or a union", name);
mmerror(PARSE_ERROR, ET_FATAL, errortext);
}
@@ -100,7 +100,7 @@ find_struct(char *name, char *next)
{
if (p->type->type != ECPGt_struct && p->type->type != ECPGt_union)
{
- sprintf(errortext, "variable %s is neither a structure nor a union", name);
+ snprintf(errortext, sizeof(errortext), "variable %s is neither a structure nor a union", name);
mmerror(PARSE_ERROR, ET_FATAL, errortext);
}
@@ -142,7 +142,7 @@ find_variable(char *name)
if (p == NULL)
{
- sprintf(errortext, "The variable %s is not declared", name);
+ snprintf(errortext, sizeof(errortext), "The variable %s is not declared", name);
mmerror(PARSE_ERROR, ET_FATAL, errortext);
}
@@ -290,7 +290,7 @@ get_typedef(char *name)
for (this = types; this && strcmp(this->name, name); this = this->next);
if (!this)
{
- sprintf(errortext, "invalid datatype '%s'", name);
+ snprintf(errortext, sizeof(errortext), "invalid datatype '%s'", name);
mmerror(PARSE_ERROR, ET_FATAL, errortext);
}
@@ -320,7 +320,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
}
if (pointer_len>2)
- { sprintf(errortext, "No multilevel (more than 2) pointer supported %d",pointer_len);
+ { snprintf(errortext, sizeof(errortext), "No multilevel (more than 2) pointer supported %d",pointer_len);
mmerror(PARSE_ERROR, ET_FATAL, errortext);
/* mmerror(PARSE_ERROR, ET_FATAL, "No multilevel (more than 2) pointer supported %d",pointer_len);*/
}