]> git.ipfire.org Git - thirdparty/git.git/commit
daemon: fix IPv6 address truncation in ip2str()
authorSebastien Tardif <sebtardif@ncf.ca>
Thu, 28 May 2026 02:56:55 +0000 (02:56 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 May 2026 05:25:41 +0000 (14:25 +0900)
commit30c8fda1ab6d55d3b0129bb1686c23bf06cd5b0d
tree3cfbe2b0b3ee679a873c2eddbd46116abe03d6d6
parentb8cda126b4e0fbfd514b26dec4ee8a1c6849abe9
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