Wireshark mailing list archives
IPv6 longest representation vs INET6_ADDRSTRLEN
From: Jakub Zawadzki <darkjames-ws () darkjames pl>
Date: Thu, 5 May 2011 14:01:06 +0200
Hi, epan/ftypes/ftype_bytes.c:ipv6_repr_len() returns 39 which is length of: "XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX" But it's common to have INET6_ADDRSTRLEN defined to 46, which I believe is length of "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255" + 1 byte for NUL. IMHO when IPv4-mapping is used the longest address is: ::ffff:255.255.255.255 (22B) Anyone knows inet_ntop(AF_INET6, ..) implementation which can actually use 46 bytes? I'm asking because current code can lead to buffer overlow: ipv6_to_repr() -> ip6_to_str_buf((struct e_in6_addr *)fv->value.bytes->data, buf); -> inet_ntop(AF_INET6, (const guchar*)ad, buf, INET6_ADDRSTRLEN); I'm planning to fix it by #define MAX_IPV6_STR_LEN inside to_str.h (like we do for other addresses), but should it be 40 or 46 (or defined to INET6_ADDRSTRLEN)? ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- IPv6 longest representation vs INET6_ADDRSTRLEN Jakub Zawadzki (May 05)
- Re: IPv6 longest representation vs INET6_ADDRSTRLEN Jakub Zawadzki (May 05)
- Re: IPv6 longest representation vs INET6_ADDRSTRLEN Gerald Combs (May 05)
- Re: IPv6 longest representation vs INET6_ADDRSTRLEN Sake Blok (May 14)
- Re: IPv6 longest representation vs INET6_ADDRSTRLEN Gerald Combs (May 05)
- Re: IPv6 longest representation vs INET6_ADDRSTRLEN Jakub Zawadzki (May 05)