Subject: Re: c-ares + IPv6 problem

Re: c-ares + IPv6 problem

From: Steinar H. Gunderson <sesse_at_google.com>
Date: Mon, 16 May 2011 15:45:14 +0200

Den 16. mai 2011 15:38 skrev Peter Pentchev <roam_at_ringlet.net> følgende:
>> +  const size_t  ipv4_size = sizeof("255.255.255.255,") - 1;
>> +  const size_t  ipv6_size = sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255,") - 1;
> Hmm, theoretically speaking, an IPv6 address might be even longer than
> that (think link-local addresses with %ifname at the end).  However,
> I stronly doubt somebody would actually *use* something much longer...
> but then again, this last sentence fragment has led to some very, very
> bad buffer overflow exploits over the last twenty years :)

And in any case, you will probably want to use these definitions
instead of rolling your own:

/usr/include/netinet/in.h:#define INET_ADDRSTRLEN 16
/usr/include/netinet/in.h:#define INET6_ADDRSTRLEN 46

/* Steinar */

-- 
Software Engineer, Google Switzerland
Received on 2011-05-16