git: 8cd71a0e01d6 - main - libfetch: parse IPv4address in IPv6address properly

From: Ka Ho Ng <khng_at_FreeBSD.org>
Date: Thu, 11 Jul 2024 19:49:02 UTC
The branch main has been updated by khng:

URL: https://cgit.FreeBSD.org/src/commit/?id=8cd71a0e01d60cc4eb0cdef3c62556a516976b77

commit 8cd71a0e01d60cc4eb0cdef3c62556a516976b77
Author:     Ka Ho Ng <khng@FreeBSD.org>
AuthorDate: 2024-07-11 19:48:28 +0000
Commit:     Ka Ho Ng <khng@FreeBSD.org>
CommitDate: 2024-07-11 19:48:28 +0000

    libfetch: parse IPv4address in IPv6address properly
    
    This fix parsing problems of IPv6 addresses which contains IPv4
    addresses. One example is ::192.168.0.1.
    
    Documents are in below:
    https://datatracker.ietf.org/doc/html/rfc2373#page-22
    
    Sponsored by:   Juniper Networks, Inc.
    MFC after:      1 week
    Reviewed by:    jhibbits
    Differential Revision:  https://reviews.freebsd.org/D45896
---
 lib/libfetch/fetch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c
index df97bf486f9b..12cbd0fb746f 100644
--- a/lib/libfetch/fetch.c
+++ b/lib/libfetch/fetch.c
@@ -399,7 +399,7 @@ fetchParseURL(const char *URL)
 
 	/* hostname */
 	if (*p == '[') {
-		q = p + 1 + strspn(p + 1, ":0123456789ABCDEFabcdef");
+		q = p + 1 + strspn(p + 1, ":0123456789ABCDEFabcdef.");
 		if (*q++ != ']')
 			goto ouch;
 	} else {