diff options
-rw-r--r-- | lib/libc/net/inet_pton.c | 4 |
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; |