You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/09/13 21:28:55 UTC

svn commit: r1760598 - in /tomcat/jk/trunk: native/common/jk_connect.c xdocs/miscellaneous/changelog.xml

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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1760598 - in /tomcat/jk/trunk: native/common/jk_connect.c xdocs/miscellaneous/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.
On 13/09/2016 22:28, markt@apache.org wrote:
> 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.

C not being my strong point, a review of this by those of you with
better C skills is appreciated. If you could keep an eye out for C
commits from me for the next week or two as I work on 1.2.42, that would
be great.

Mark


> 
> 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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 


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