aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/inet_net_pton.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-06-16 17:16:32 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-06-16 17:16:58 -0400
commit7b97dafa2a885b968924604e58e030aebfd96b9f (patch)
treef11153d0bc7e9293c9fe630c8d557c56c68c3415 /src/backend/utils/adt/inet_net_pton.c
parentbdf39b2c577a107063dfbbe398ff77c5b65ba731 (diff)
downloadpostgresql-7b97dafa2a885b968924604e58e030aebfd96b9f.tar.gz
postgresql-7b97dafa2a885b968924604e58e030aebfd96b9f.zip
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>
Diffstat (limited to 'src/backend/utils/adt/inet_net_pton.c')
-rw-r--r--src/backend/utils/adt/inet_net_pton.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/utils/adt/inet_net_pton.c b/src/backend/utils/adt/inet_net_pton.c
index 1d32d2f04f6..20e6efe7495 100644
--- a/src/backend/utils/adt/inet_net_pton.c
+++ b/src/backend/utils/adt/inet_net_pton.c
@@ -495,7 +495,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;