This is an automated email from the ASF dual-hosted git repository.

ChristopherSchultz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat-connectors.git

commit 412cb1e32c0db661ce7d18e8142d41165b5b0452
Author: Christopher Schultz <[email protected]>
AuthorDate: Mon Jun 8 12:39:48 2026 -0400

    Don't assume IPv6 when not IPv4
---
 native/common/jk_connect.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/native/common/jk_connect.c b/native/common/jk_connect.c
index 5477be83b..9c0f653cd 100644
--- a/native/common/jk_connect.c
+++ b/native/common/jk_connect.c
@@ -1333,10 +1333,12 @@ char *jk_dump_sinfo(jk_sock_t sd, char *buf, size_t 
size)
                 snprintf(pb, sizeof(pb), ":%u", ntohs(insa->sin_port));
             }
 #if JK_HAVE_IPV6
-            else {
+            else if (sa->sa_family == JK_INET6) {
                 struct sockaddr_in6 *insa = (struct sockaddr_in6 *)&lsaddr;
                 inet_ntop6((unsigned char *)&insa->sin6_addr, buf, size);
                 snprintf(pb, sizeof(pb), ":%u", ntohs(insa->sin6_port));
+            } else {
+                snprintf(pb, sizeof(pb), "UnknownFamily");
             }
 #endif
             ps = strlen(buf);
@@ -1352,10 +1354,12 @@ char *jk_dump_sinfo(jk_sock_t sd, char *buf, size_t 
size)
                 snprintf(pb, sizeof(pb), ":%u", ntohs(insa->sin_port));
             }
 #if JK_HAVE_IPV6
-            else {
+            else if (sa->sa_family == JK_INET6) {
                 struct sockaddr_in6 *insa = (struct sockaddr_in6 *)&rsaddr;
                 inet_ntop6((unsigned char *)&insa->sin6_addr, buf + ps, size - 
ps);
                 snprintf(pb, sizeof(pb), ":%u", ntohs(insa->sin6_port));
+            } else {
+                snprintf(pb, sizeof(pb), "UnknownFamily");
             }
 #endif
             strncat(buf, pb, size - strlen(buf) - 1);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to