Thread (7 messages) flat view 7 messages, 2 authors, 2016-06-15

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

From: Alex Riesen <hidden>
Date: 2016-06-15 22:46:41

2009/4/29 Augie Fackler [off-list ref]:
quoted hunk ↗ jump to hunk
@@ -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);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help