Commit b26e2081 authored by Tom Lane's avatar Tom Lane

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.
parent 64235fec
...@@ -4966,9 +4966,8 @@ conninfo_uri_parse_params(char *params, ...@@ -4966,9 +4966,8 @@ conninfo_uri_parse_params(char *params,
++p; ++p;
break; break;
} }
else
/* Advance, NUL is checked in the 'if' above */ ++p; /* Advance over all other bytes. */
++p;
} }
keyword = conninfo_uri_decode(keyword, errorMessage); keyword = conninfo_uri_decode(keyword, errorMessage);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment