cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: debians ipv6/c-ares patch

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 8 Jul 2008 12:59:10 +0200 (CEST)

On Tue, 8 Jul 2008, Phil Blundell wrote:

> It looks like one line got lost from Curl_ip2addr6(); it needs:
>
> --- hostares.c~ 2008-07-08 11:29:09.000000000 +0100
> +++ hostares.c 2008-07-08 11:39:17.000000000 +0100
> @@ -339,6 +339,7 @@
> h->h_addr_list[0] = (char*)addrentry;
> h->h_name = &buf->hostname[0];
> h->h_aliases = NULL;
> + h->h_addrtype = AF_INET6;
>
> /* Now store the dotted version of the address */
> strcpy (h->h_name, hostname);
>
> Other than that, your patch seemed to work fine in my limited testing.

Oops, also fell over another remaining flaw that I fixed with this:

--- hostares.c 2008-07-08 12:57:37.000000000 +0200
+++ hostares.c 2008-07-08 12:57:34.000000000 +0200
@@ -337,6 +337,7 @@
    addrentry = &buf->addrentry;
    memcpy(addrentry, in, sizeof (*in));
    h->h_addr_list[0] = (char*)addrentry;
+ h->h_addr_list[1] = NULL; /* terminate list of entries */
    h->h_name = &buf->hostname[0];
    h->h_aliases = NULL;
    h->h_addrtype = AF_INET6;

(otherwise easily causing segfaults...)

-- 
  / daniel.haxx.se
Received on 2008-07-08