You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by sc...@apache.org on 2026/06/09 13:44:22 UTC
(tomcat-connectors) 09/20: Move the else outside of the ifdef
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 84506485f78cd35739387aa3bd5b2d463bc1ce5d
Author: Christopher Schultz <ch...@christopherschultz.net>
AuthorDate: Mon Jun 8 13:45:57 2026 -0400
Move the else outside of the ifdef
Expand the buffer to be able to store the unknown family note.
---
native/common/jk_connect.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/native/common/jk_connect.c b/native/common/jk_connect.c
index 9c0f653cd..812231b2c 100644
--- a/native/common/jk_connect.c
+++ b/native/common/jk_connect.c
@@ -1324,7 +1324,7 @@ char *jk_dump_sinfo(jk_sock_t sd, char *buf, size_t size)
if (getsockname(sd, &lsaddr, &salen) == 0) {
salen = sizeof(rsaddr);
if (getpeername(sd, &rsaddr, &salen) == 0) {
- char pb[8];
+ char pb[16];
size_t ps;
struct sockaddr *sa = (struct sockaddr *)&lsaddr;
if (sa->sa_family == JK_INET) {
@@ -1337,10 +1337,12 @@ char *jk_dump_sinfo(jk_sock_t sd, char *buf, size_t size)
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));
+#endif
} else {
+ buf[0] = '\0';
snprintf(pb, sizeof(pb), "UnknownFamily");
}
-#endif
+
ps = strlen(buf);
strncat(buf, pb, size - ps - 1);
ps = strlen(buf);
@@ -1358,10 +1360,11 @@ char *jk_dump_sinfo(jk_sock_t sd, char *buf, size_t size)
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));
+#endif
} else {
+ buf[ps] = '\0';
snprintf(pb, sizeof(pb), "UnknownFamily");
}
-#endif
strncat(buf, pb, size - strlen(buf) - 1);
return buf;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org