summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2005-07-29 16:10:35 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2005-07-29 16:10:35 +0000
commit14ce655361c0eef8a4e56dac44b733ea45d2ac75 (patch)
tree2b40292fc6dab16aa1be809fe881870044dbfd15 /lib
parente4c373935d937bf4461fea7bdca0abb3aac10c94 (diff)
Notes
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 65f28cfd02bf..78dbf44d23a5 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;