Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 5 Jun 2018 16:51:27 -0700
From: Arthur Jones <arthur.jones@...erbed.com>
To: musl@...ts.openwall.com
Cc: chris@...nsourcerouting.org
Subject: [PATCH] inet_ntop: do not compress single zeros in IPv6

glibc does not compress a single :0: to ::, we're not
doing anything wrong, but this change will make us more
compatible w/ glibc and fix a downstream testing issue
here: https://github.com/FRRouting/frr/issues/2375

I ran the "fix" through libc-test inet_pton.c on alpine
linux edge and it passed...

I'm not subscribed to the mailing list so please CC me...
---
 src/network/inet_ntop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/network/inet_ntop.c b/src/network/inet_ntop.c
index 14f9f4c4..4bfef2c5 100644
--- a/src/network/inet_ntop.c
+++ b/src/network/inet_ntop.c
@@ -36,7 +36,7 @@ const char *inet_ntop(int af, const void *restrict a0, char *restrict s, socklen
 			j = strspn(buf+i, ":0");
 			if (j>max) best=i, max=j;
 		}
-		if (max>2) {
+		if (max>3) {
 			buf[best] = buf[best+1] = ':';
 			memmove(buf+best+2, buf+best+max, i-best-max+1);
 		}
-- 
2.15.1 (Apple Git-101)

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.