summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2005-07-27 14:33:36 +0000
committerume <ume@FreeBSD.org>2005-07-27 14:33:36 +0000
commitca8316b8dd70d583004789919db2eb8cc4720940 (patch)
tree4f3b518c78998bf7a6e141201db1be03c871909f /lib
parentd675d9c68fc46a791701a318b0c4035d0ce8e66a (diff)
downloadFreeBSD-src-ca8316b8dd70d583004789919db2eb8cc4720940.zip
FreeBSD-src-ca8316b8dd70d583004789919db2eb8cc4720940.tar.gz
don't accept invalid form of an address like 1:2:3:4:5:6:7::8.
PR: bin/84106 Obtained from: BIND9 MFC after: 2 days
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/inet_pton.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/net/inet_pton.c b/lib/libc/net/inet_pton.c
index 65f28cf..78dbf44 100644
--- a/lib/libc/net/inet_pton.c
+++ b/lib/libc/net/inet_pton.c
@@ -88,6 +88,8 @@ inet_pton4(const char *src, u_char *dst)
if ((pch = strchr(digits, ch)) != NULL) {
u_int new = *tp * 10 + (pch - digits);
+ if (saw_digit && *tp == 0)
+ return (0);
if (new > 255)
return (0);
*tp = new;
@@ -195,6 +197,8 @@ inet_pton6(const char *src, u_char *dst)
const int n = tp - colonp;
int i;
+ if (tp == endp)
+ return (0);
for (i = 1; i <= n; i++) {
endp[- i] = colonp[n - i];
colonp[n - i] = 0;
OpenPOWER on IntegriCloud