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

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

 




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:

		inet_ntop(hent->h_addrtype, &sa.sin_addr,
			  addrbuf, sizeof(addrbuf));

		free(canon_hostname); /* CRASH */
		canon_hostname = xstrdup(hent->h_name);
		free(ip_address);


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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]