aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-02-21 12:59:25 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2015-02-21 12:59:39 -0500
commitf389b6e0a7637de014e5ea1adbcfa50108bb4e58 (patch)
treef93bdf9a38a3b7c41448e4fdb503244757485ca0
parenta196e67f930e0fef10928928122770d59b14b653 (diff)
downloadpostgresql-f389b6e0a7637de014e5ea1adbcfa50108bb4e58.tar.gz
postgresql-f389b6e0a7637de014e5ea1adbcfa50108bb4e58.zip
Fix misparsing of empty value in conninfo_uri_parse_params().
After finding an "=" character, the pointer was advanced twice when it should only advance once. This is harmless as long as the value after "=" has at least one character; but if it doesn't, we'd miss the terminator character and include too much in the value. In principle this could lead to reading off the end of memory. It does not seem worth treating as a security issue though, because it would happen on client side, and besides client logic that's taking conninfo strings from untrusted sources has much worse security problems than this. Report and patch received off-list from Thomas Fanghaenel. Back-patch to 9.2 where the faulty code was introduced.
-rw-r--r--src/interfaces/libpq/fe-connect.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index c524661ec77..1721b314666 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -4950,9 +4950,8 @@ conninfo_uri_parse_params(char *params,
++p;
break;
}
-
- /* Advance, NUL is checked in the 'if' above */
- ++p;
+ else
+ ++p; /* Advance over all other bytes. */
}
keyword = conninfo_uri_decode(keyword, errorMessage);