Re: [PATCH] Workaround for ai_canonname sometimes coming back as null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/4/29 Augie Fackler <durin42@xxxxxxxxx>:> On Apr 29, 2009, at 4:55 PM, Alex Riesen wrote:>> 2009/4/29 Augie Fackler <durin42@xxxxxxxxx>:>>>>>> @@ -459,7 +459,10 @@ static void parse_extra_args(char *extra_args, int>>> buflen)>>>                               inet_ntop(AF_INET, &sin_addr->sin_addr,>>>                                         addrbuf, sizeof(addrbuf));>>>                               free(canon_hostname);>>> -                               canon_hostname =>>> xstrdup(ai->ai_canonname);>>> +                               if (ai->ai_canonname)>>> +                                       canon_hostname =>>> xstrdup(ai->ai_canonname);>>> +                               else>>> +                                       canon_hostname = "unknown";>>>> This last line will crash some lines down, when canon_hostname is free'd:>>>> Odd, because I'm running with that exact code and not seeing the problem.> Should I resubmit an updated patch that xstrdup's unknown into> canon_hostname?>
I think you can just let canon_hostname be NULL (i.e. don't strdup it,if ai_canonname is NULL). NULL values of canon_hostname seemto be handled just fine: see path_ok and strbuf_expand_dict_cb (strbuf.c)��.n��������+%������w��{.n��������n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�m


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]