about summary refs log tree commit diff
path: root/src/network
diff options
context:
space:
mode:
authorArthur Jones <arthur.jones@riverbed.com>2018-06-05 16:51:27 -0700
committerRich Felker <dalias@aerifal.cx>2018-06-26 16:47:31 -0400
commit5c8e69267b9ae919e55eee4b79580224111bc3ba (patch)
tree400887a1d8879984a86d3c1a13f44550dd42bf80 /src/network
parentda5851e9f464f74533cc8270c932cf6466ff3256 (diff)
downloadmusl-5c8e69267b9ae919e55eee4b79580224111bc3ba.tar.gz
musl-5c8e69267b9ae919e55eee4b79580224111bc3ba.tar.xz
musl-5c8e69267b9ae919e55eee4b79580224111bc3ba.zip
inet_ntop: do not compress single zeros in IPv6
maintainer's note: this change is for conformance with RFC 5952,
4.2.2, which explicitly forbids use of :: to shorten a single 16-bit 0
field when producing the canonical text representation for an IPv6
address. fixes a test failure reported by Philip Homburg, who also
submitted a patch, but this fix is simpler and should produce smaller
code.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/inet_ntop.c2
1 files changed, 1 insertions, 1 deletions
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);
 		}