Subject: Re: ares_init.c +1295, missing else?

Re: ares_init.c +1295, missing else?

From: Dima Tisnek <dimaqq_at_gmail.com>
Date: Mon, 14 Feb 2011 12:10:44 -0700

Sure, here it is:

diff --git a/ares_init.c b/ares_init.c
index d2f4a72..62e09b4 100644
--- a/ares_init.c
+++ b/ares_init.c
@@ -1292,7 +1292,7 @@ static int config_sortlist(struct apattern
**sortlist, int *nsort,
           if (!sortlist_alloc(sortlist, nsort, &pat))
             return ARES_ENOMEM;
         }
- if (ipbufpfx[0] &&
+ else if (ipbufpfx[0] &&
           (bits = ares_inet_net_pton(AF_INET, ipbufpfx, &pat.addrV4,
                                      sizeof(pat.addrV4))) > 0)
         {

On 13 February 2011 11:35, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Fri, 11 Feb 2011, Dima Tisnek wrote:
>
>> it occurs to me that perhaps there's a missing "else" in ares_init.c line
>> 1295;
>>
>> without an else there, contents of "pat" that could have been successfully
>> set just above, may be clobbered by successive unsuccessful calls to
>> "xxx_pton" or "ip_addr".
>
> Can you please show us a patch for your suggested change to make it clearer
> exactly what you mean?
>
> --
>
>  / daniel.haxx.se
>
Received on 2011-02-14