
On 04/11/09 11:06, Richard W.M. Jones wrote:
Are you sure about this? According to the man page for inet_ntop the INET*_ADDRSTRLEN macro should be long enough already:
AF_INET src points to a struct in_addr (in network byte order) which is converted to an IPv4 network address in the dotted-decimal for- mat, "ddd.ddd.ddd.ddd". The buffer dst must be at least INET_ADDRSTRLEN bytes long.
AF_INET6 src points to a struct in6_addr (in network byte order) which is converted to a representation of this address in the most appro- priate IPv6 network address format for this address. The buffer dst must be at least INET6_ADDRSTRLEN bytes long.
No, I wasn't sure :) However, reading this and realising I miscalculated the maximum size of an IPv4 address[1], I'll withdraw this patch. Thanks, Matt [1] INET_ADDRSTRLEN == 16. I forgot there's only 3 dots, so I didn't think it was leaving space. -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team M: +44 (0)7977 267231 GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490