From d4d8a46e5dfdcab6f77a0e71f369dd8a743a5fb2 Mon Sep 17 00:00:00 2001 From: claudio <> Date: Thu, 6 May 2010 15:47:14 +0000 Subject: Do not return success when the IPv6 address has a :: and 8 hex sections. ::1:2:3:4:5:6:7:8 for example. PR 6277, fix by Jun KAWAI (kwj at vlax net) OK henning, gilles, jsing (who also reminded me to remove the now wrong comment about superfluous ::) --- src/lib/libc/net/inet_pton.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/libc/net/inet_pton.c b/src/lib/libc/net/inet_pton.c index 096ff65772..7e521c3286 100644 --- a/src/lib/libc/net/inet_pton.c +++ b/src/lib/libc/net/inet_pton.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet_pton.c,v 1.7 2006/12/30 23:37:37 itojun Exp $ */ +/* $OpenBSD: inet_pton.c,v 1.8 2010/05/06 15:47:14 claudio Exp $ */ /* Copyright (c) 1996 by Internet Software Consortium. * @@ -114,8 +114,7 @@ inet_pton4(const char *src, u_char *dst) * return: * 1 if `src' is a valid [RFC1884 2.2] address, else 0. * notice: - * (1) does not touch `dst' unless it's returning 1. - * (2) :: in a full address is silently ignored. + * does not touch `dst' unless it's returning 1. * credit: * inspired by Mark Andrews. * author: @@ -199,6 +198,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; -- cgit v1.2.3-55-g6feb