Author: markt
Date: Tue Sep 13 21:28:54 2016
New Revision: 1760598

URL: http://svn.apache.org/viewvc?rev=1760598&view=rev
Log:
Fix BZ 59164. Avoid crash during logging of failure to resolve worker host name.

Modified:
    tomcat/jk/trunk/native/common/jk_connect.c
    tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/jk/trunk/native/common/jk_connect.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_connect.c?rev=1760598&r1=1760597&r2=1760598&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_connect.c (original)
+++ tomcat/jk/trunk/native/common/jk_connect.c Tue Sep 13 21:28:54 2016
@@ -1285,17 +1285,22 @@ char *jk_dump_hinfo(jk_sockaddr_t *saddr
 {
     char pb[8];
 
-    if (saddr->family == JK_INET) {
-        inet_ntop4(saddr->ipaddr_ptr, buf, size);
-    }
+    if (saddr->ipaddr_ptr == NULL) {
+        strcpy(buf, "UnresolvedIP");
+    } else {
+        if (saddr->family == JK_INET) {
+            inet_ntop4(saddr->ipaddr_ptr, buf, size);
+        }
 #if JK_HAVE_IPV6
-    else {
-        inet_ntop6(saddr->ipaddr_ptr, buf, size);
-    }
+        else {
+            inet_ntop6(saddr->ipaddr_ptr, buf, size);
+        }
 #endif
+    }
+ 
     sprintf(pb, ":%d", saddr->port);
-
     strncat(buf, pb, size - strlen(buf) - 1);
+
     return buf;
 }
 

Modified: tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml?rev=1760598&r1=1760597&r2=1760598&view=diff
==============================================================================
--- tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml Tue Sep 13 21:28:54 2016
@@ -80,6 +80,10 @@
         initialization was causing a hang on shutdown. Patch provided by 
Matthew
         Reiter. (markt)
       </fix>
+      <fix>
+        <bug>59164</bug>: Fix crash on first connection if a host name is
+        specified for the worker that cannot be resolved to an IP address.
+        (markt)
     </changelog>
   </subsection>
 </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to