From: Tom Lane Date: Thu, 16 Jun 2016 21:16:32 +0000 (-0400) Subject: Fix validation of overly-long IPv6 addresses. X-Git-Tag: REL9_6_BETA2~24 X-Git-Url: http://git.postgresql.org/gitweb/-?a=commitdiff_plain;h=4c56f3269a84a81461cc53941e0eee02fc920ab6;p=postgresql-pgindent.git Fix validation of overly-long IPv6 addresses. The inet/cidr types sometimes failed to reject IPv6 inputs with too many colon-separated fields, instead translating them to '::/0'. This is the result of a thinko in the original ISC code that seems to be as yet unreported elsewhere. Per bug #14198 from Stefan Kaltenbrunner. Report: <20160616182222.5798.959@wrigleys.postgresql.org> --- diff --git a/src/backend/utils/adt/inet_net_pton.c b/src/backend/utils/adt/inet_net_pton.c index 9064eaf64b..b8fa7d2bcc 100644 --- a/src/backend/utils/adt/inet_net_pton.c +++ b/src/backend/utils/adt/inet_net_pton.c @@ -496,7 +496,7 @@ inet_cidr_pton_ipv6(const char *src, u_char *dst, size_t size) else if (*src == '\0') goto enoent; if (tp + NS_INT16SZ > endp) - return (0); + goto enoent; *tp++ = (u_char) (val >> 8) & 0xff; *tp++ = (u_char) val & 0xff; saw_xdigit = 0;