GCC 4.0 includes a new warning option, -Wformat-literal, that emits
authorNeil Conway <neilc@samurai.com>
Sat, 30 Apr 2005 09:08:14 +0000 (09:08 +0000)
committerNeil Conway <neilc@samurai.com>
Sat, 30 Apr 2005 09:08:14 +0000 (09:08 +0000)
commitff1d28084f5cd150ad918a05f92ced32243cbb02
treebfe316ea008e70f0b9e729ad1ad97b442d6cbb39
parent6ed2e017bf70543dc32cab66e521a993e25f4ba0
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.

This patch fixes a bug in pg_dump (triggers with formatting sequences
in their names are not dumped correctly) and some related pg_dump
code that looks dubious; cleanups for more harmless instances have
been applied to more recent branches. This patch also fixes an
additional format string bug that is present in 7.2 but not in later
releases: pg_dump would also fail to correctly dump indexes with
formatting sequences in their names.
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_dump.c