]> git.ipfire.org Git - thirdparty/git.git/commit
daemon: fix IPv6 address truncation in ip2str()
authorSebastien Tardif <sebtardif@ncf.ca>
Wed, 27 May 2026 18:18:30 +0000 (18:18 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 May 2026 20:28:37 +0000 (05:28 +0900)
commit93a64929c0b654a4eb84458cb10cd9f469b7ee89
tree3cfbe2b0b3ee679a873c2eddbd46116abe03d6d6
parent4a1c74e2dad0d3a1f112c381fc279bbd7ea163a7
daemon: fix IPv6 address truncation in ip2str()

The sockaddr struct size (ai_addrlen) is passed as the output buffer
size to inet_ntop(). For IPv6, sizeof(sockaddr_in6) is 28 bytes but
INET6_ADDRSTRLEN is 46, so long IPv6 addresses are silently truncated.

Fix this by passing sizeof(ip) instead, which is the actual size of
the destination buffer. Drop the now-unused len parameter from
ip2str() and update all callers.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
daemon.c