aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2005-04-30 08:08:51 +0000
committerNeil Conway <neilc@samurai.com>2005-04-30 08:08:51 +0000
commit47458f8c2fd97be1637343758223d78fc31f61f8 (patch)
tree087078deb75ab3a48c99816c4bd6c175f4beae43 /src/backend/utils/adt/ruleutils.c
parent16d4418bf51693cc2528c33f7751bb882f7ad023 (diff)
downloadpostgresql-47458f8c2fd97be1637343758223d78fc31f61f8.tar.gz
postgresql-47458f8c2fd97be1637343758223d78fc31f61f8.zip
GCC 4.0 includes a new warning option, -Wformat-literal, that emits
a warning when a variable is used as a format string for printf() and similar functions (if the variable is derived from untrusted data, it could include unexpected formatting sequences). This emits too many warnings to be enabled by default, but it does flag a few dubious constructs in the Postgres tree. This patch fixes up the obvious variants: functions that are passed a variable format string but no additional arguments. Most of these are harmless (e.g. the ruleutils stuff), but there is at least one actual bug here: if you create a trigger named "%sfoo", pg_dump will read uninitialized memory and fail to dump the trigger correctly.
Diffstat (limited to 'src/backend/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 37f3687688c..d2f51de3c91 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -3,7 +3,7 @@
* back to source text
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.193 2005/04/14 20:03:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.194 2005/04/30 08:08:50 neilc Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -733,7 +733,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, int prettyFlags)
AttrNumber attnum = idxrec->indkey.values[keyno];
if (!colno)
- appendStringInfo(&buf, sep);
+ appendStringInfoString(&buf, sep);
sep = ", ";
if (attnum != 0)
@@ -1885,7 +1885,7 @@ get_select_query_def(Query *query, deparse_context *context,
Oid sortcoltype;
TypeCacheEntry *typentry;
- appendStringInfo(buf, sep);
+ appendStringInfoString(buf, sep);
sortexpr = get_rule_sortgroupclause(srt, query->targetList,
force_colno, context);
sortcoltype = exprType(sortexpr);
@@ -1954,7 +1954,7 @@ get_basic_select_query(Query *query, deparse_context *context,
{
SortClause *srt = (SortClause *) lfirst(l);
- appendStringInfo(buf, sep);
+ appendStringInfoString(buf, sep);
get_rule_sortgroupclause(srt, query->targetList,
false, context);
sep = ", ";
@@ -1976,7 +1976,7 @@ get_basic_select_query(Query *query, deparse_context *context,
if (tle->resjunk)
continue; /* ignore junk entries */
- appendStringInfo(buf, sep);
+ appendStringInfoString(buf, sep);
sep = ", ";
colno++;
@@ -2040,7 +2040,7 @@ get_basic_select_query(Query *query, deparse_context *context,
{
GroupClause *grp = (GroupClause *) lfirst(l);
- appendStringInfo(buf, sep);
+ appendStringInfoString(buf, sep);
get_rule_sortgroupclause(grp, query->targetList,
false, context);
sep = ", ";
@@ -2229,7 +2229,7 @@ get_insert_query_def(Query *query, deparse_context *context)
if (tle->resjunk)
continue; /* ignore junk entries */
- appendStringInfo(buf, sep);
+ appendStringInfoString(buf, sep);
sep = ", ";
/*
@@ -2301,7 +2301,7 @@ get_update_query_def(Query *query, deparse_context *context)
if (tle->resjunk)
continue; /* ignore junk entries */
- appendStringInfo(buf, sep);
+ appendStringInfoString(buf, sep);
sep = ", ";
/*
@@ -3268,7 +3268,7 @@ get_rule_expr(Node *node, deparse_context *context,
if (tupdesc == NULL ||
!tupdesc->attrs[i]->attisdropped)
{
- appendStringInfo(buf, sep);
+ appendStringInfoString(buf, sep);
get_rule_expr(e, context, true);
sep = ", ";
}
@@ -3280,7 +3280,7 @@ get_rule_expr(Node *node, deparse_context *context,
{
if (!tupdesc->attrs[i]->attisdropped)
{
- appendStringInfo(buf, sep);
+ appendStringInfoString(buf, sep);
appendStringInfo(buf, "NULL");
sep = ", ";
}
@@ -3415,7 +3415,7 @@ get_rule_expr(Node *node, deparse_context *context,
sep = "";
foreach(l, (List *) node)
{
- appendStringInfo(buf, sep);
+ appendStringInfoString(buf, sep);
get_rule_expr((Node *) lfirst(l), context, showimplicit);
sep = ", ";
}