Subject: Re: ares_gethostbyname()

Re: ares_gethostbyname()

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 24 Jul 2006 10:07:49 +0200 (CEST)

On Sun, 23 Jul 2006, Gisle Vanem wrote:

>> I'm under the impression that the IPv6 parts of c-ares still aren't very
>> widely used and might still suffer from artifacts like this. For example,
>> we don't use it for ipv6 in libcurl.
>
> We use it now ... since I added support for the combination USE_ARES and
> ENABLE_IPV6. With that libcurl resolves hostnames to IPv6 addresses fine.

Ah, I didn't really notice this. I'll need to check it out!

> BTW. With the above combo, I've found a bug. In hostasyn.c /
> addrinfo_callback():
>
> * IPv6: Curl_addrinfo_copy() returns the input pointer!
> */
> Curl_addrinfo *ai = Curl_addrinfo_copy(addr, conn->async.port);
>
> 'addr' comes from c-ares and gets freed when the callback returns. This
> leads to a double free and crash if CURLDEBUG is enabled. What to do? Modify
> c-ares or modify Curl_addrinfo_copy to do a deep-copy when using c-ares?

It feels like a bad usage in libcurl so I think c-ares is fine and the fix
should be done in libcurl. Don't you agree?

-- 
   c-ares -- my preferred DNS asynch resolver library
Received on 2006-07-24