aboutsummaryrefslogtreecommitdiff
path: root/src/include/fe_utils/string_utils.h
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2016-08-08 10:07:46 -0400
committerNoah Misch <noah@leadboat.com>2016-08-08 10:07:46 -0400
commitfcd15f13581f6d75c63d213220d5a94889206c1b (patch)
tree8d089b7347202753584321cd32c9101f05394834 /src/include/fe_utils/string_utils.h
parent41f18f021a0882eccbeca62e2ed4b66c6b96e9c9 (diff)
downloadpostgresql-fcd15f13581f6d75c63d213220d5a94889206c1b.tar.gz
postgresql-fcd15f13581f6d75c63d213220d5a94889206c1b.zip
Obstruct shell, SQL, and conninfo injection via database and role names.
Due to simplistic quoting and confusion of database names with conninfo strings, roles with the CREATEDB or CREATEROLE option could escalate to superuser privileges when a superuser next ran certain maintenance commands. The new coding rule for PQconnectdbParams() calls, documented at conninfo_array_parse(), is to pass expand_dbname=true and wrap literal database names in a trivial connection string. Escape zero-length values in appendConnStrVal(). Back-patch to 9.1 (all supported versions). Nathan Bossart, Michael Paquier, and Noah Misch. Reviewed by Peter Eisentraut. Reported by Nathan Bossart. Security: CVE-2016-5424
Diffstat (limited to 'src/include/fe_utils/string_utils.h')
-rw-r--r--src/include/fe_utils/string_utils.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/fe_utils/string_utils.h b/src/include/fe_utils/string_utils.h
index c709406628e..7bbed360a3b 100644
--- a/src/include/fe_utils/string_utils.h
+++ b/src/include/fe_utils/string_utils.h
@@ -42,6 +42,7 @@ extern void appendByteaLiteral(PQExpBuffer buf,
extern void appendShellString(PQExpBuffer buf, const char *str);
extern void appendConnStrVal(PQExpBuffer buf, const char *str);
+extern void appendPsqlMetaConnect(PQExpBuffer buf, const char *dbname);
extern bool parsePGArray(const char *atext, char ***itemarray, int *nitems);