GCC 4.0 includes a new warning option, -Wformat-literal, that emits
authorNeil Conway <neilc@samurai.com>
Sat, 30 Apr 2005 08:36:18 +0000 (08:36 +0000)
committerNeil Conway <neilc@samurai.com>
Sat, 30 Apr 2005 08:36:18 +0000 (08:36 +0000)
commit9cd7f60ff00a379764081001714bb185992b204c
treec2cbddeaa5a52c25848aab71abc79075625de248
parentad3d93199021eb38fa6c99106de92f2f9e1d4f94
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.
src/backend/utils/adt/ruleutils.c
src/bin/initdb/initdb.c
src/bin/pg_dump/dumputils.c
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_dump.c