summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2010-05-06 15:47:14 +0000
committerclaudio <claudio@openbsd.org>2010-05-06 15:47:14 +0000
commit151aa445427cd5a40e2b03d273539fc93dac4556 (patch)
tree48a2e7d0cd5a45a56a84b24ede882547a7f4c53d
parentOur libc provides ssp, so use that. (diff)
downloadwireguard-openbsd-151aa445427cd5a40e2b03d273539fc93dac4556.tar.xz
wireguard-openbsd-151aa445427cd5a40e2b03d273539fc93dac4556.zip
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 ::)
-rw-r--r--lib/libc/net/inet_pton.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/net/inet_pton.c b/lib/libc/net/inet_pton.c
index 096ff657726..7e521c32867 100644
--- a/lib/libc/net/inet_pton.c
+++ b/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;