ASF Bugzilla – Attachment 31557 Details for
Bug 56452
IPv6 address and log level debug caused crash
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch (against mod_jk/trunk)
56452.diff (text/plain), 5.60 KB, created by
Christopher Schultz
on 2014-04-24 21:39:20 UTC
(
hide
)
Description:
Proposed patch (against mod_jk/trunk)
Filename:
MIME Type:
Creator:
Christopher Schultz
Created:
2014-04-24 21:39:20 UTC
Size:
5.60 KB
patch
obsolete
>Index: native/common/jk_connect.c >=================================================================== >--- native/common/jk_connect.c (revision 1589880) >+++ native/common/jk_connect.c (working copy) >@@ -559,7 +559,7 @@ > int timeout, int connect_timeout, > int sock_buf, jk_logger_t *l) > { >- char buf[64]; >+ char buf[100]; > jk_sock_t sd; > int set = 1; > int ret = 0; >@@ -764,7 +764,7 @@ > else { > if (JK_IS_DEBUG_LEVEL(l)) > jk_log(l, JK_LOG_DEBUG, "socket %d [%s] connected", >- sd, jk_dump_sinfo(sd, buf)); >+ sd, jk_dump_sinfo(sd, buf, sizeof buf)); > } > JK_TRACE_EXIT(l); > return sd; >@@ -841,7 +841,7 @@ > int jk_shutdown_socket(jk_sock_t sd, jk_logger_t *l) > { > char dummy[512]; >- char buf[64]; >+ char buf[100]; > char *sb = NULL; > int rc = 0; > size_t rd = 0; >@@ -859,7 +859,7 @@ > > save_errno = errno; > if (JK_IS_DEBUG_LEVEL(l)) { >- sb = jk_dump_sinfo(sd, buf); >+ sb = jk_dump_sinfo(sd, buf, sizeof buf); > jk_log(l, JK_LOG_DEBUG, "About to shutdown socket %d [%s]", > sd, sb); > } >@@ -1228,7 +1228,7 @@ > return buf; > } > >-char *jk_dump_sinfo(jk_sock_t sd, char *buf) >+char *jk_dump_sinfo(jk_sock_t sd, char *buf, const size_t size) > { > struct sockaddr rsaddr; > struct sockaddr lsaddr; >@@ -1242,13 +1242,13 @@ > size_t ps; > if (lsaddr.sa_family == JK_INET) { > struct sockaddr_in *sa = (struct sockaddr_in *)&lsaddr; >- inet_ntop4((unsigned char *)&sa->sin_addr, buf, 16); >+ inet_ntop4((unsigned char *)&sa->sin_addr, buf, size); > sprintf(pb, ":%d", (unsigned int)htons(sa->sin_port)); > } > #if JK_HAVE_IPV6 > else { > struct sockaddr_in6 *sa = (struct sockaddr_in6 *)&lsaddr; >- inet_ntop6((unsigned char *)&sa->sin6_addr, buf, 64); >+ inet_ntop6((unsigned char *)&sa->sin6_addr, buf, size); > sprintf(pb, ":%d", (unsigned int)htons(sa->sin6_port)); > } > #endif >@@ -1257,17 +1257,17 @@ > ps = strlen(buf); > if (rsaddr.sa_family == JK_INET) { > struct sockaddr_in *sa = (struct sockaddr_in *)&rsaddr; >- inet_ntop4((unsigned char *)&sa->sin_addr, buf + ps, 16); >+ inet_ntop4((unsigned char *)&sa->sin_addr, buf + ps, size - ps); > sprintf(pb, ":%d", (unsigned int)htons(sa->sin_port)); > } > #if JK_HAVE_IPV6 > else { > struct sockaddr_in6 *sa = (struct sockaddr_in6 *)&rsaddr; >- inet_ntop6((unsigned char *)&sa->sin6_addr, buf + ps, 64); >+ inet_ntop6((unsigned char *)&sa->sin6_addr, buf + ps, size - ps); > sprintf(pb, ":%d", (unsigned int)htons(sa->sin6_port)); > } > #endif >- strcat(buf, pb); >+ strncat(buf, pb, size - strlen(buf) - 1); > return buf; > } > } >@@ -1292,7 +1292,7 @@ > struct pollfd fds; > int rc; > int save_errno; >- char buf[64]; >+ char buf[100]; > > JK_TRACE_ENTER(l); > >@@ -1309,7 +1309,7 @@ > if (JK_IS_DEBUG_LEVEL(l)) { > jk_log(l, JK_LOG_DEBUG, > "timeout during poll on socket %d [%s] (timeout=%d)", >- sd, jk_dump_sinfo(sd, buf), timeout); >+ sd, jk_dump_sinfo(sd, buf, sizeof buf), timeout); > } > /* Timeout. Set the errno to timeout */ > errno = ETIMEDOUT; >@@ -1321,7 +1321,7 @@ > if (JK_IS_DEBUG_LEVEL(l)) { > jk_log(l, JK_LOG_DEBUG, > "error during poll on socket %d [%s] (errno=%d)", >- sd, jk_dump_sinfo(sd, buf), errno); >+ sd, jk_dump_sinfo(sd, buf, sizeof buf), errno); > } > errno = save_errno; > JK_TRACE_EXIT(l); >@@ -1332,7 +1332,7 @@ > if (JK_IS_DEBUG_LEVEL(l)) { > jk_log(l, JK_LOG_DEBUG, > "error event during poll on socket %d [%s] (event=%d)", >- sd, jk_dump_sinfo(sd, buf), save_errno); >+ sd, jk_dump_sinfo(sd, buf, sizeof buf), save_errno); > } > errno = save_errno; > JK_TRACE_EXIT(l); >@@ -1349,7 +1349,7 @@ > struct timeval tv; > int rc; > int save_errno; >- char buf[64]; >+ char buf[100]; > > JK_TRACE_ENTER(l); > >@@ -1367,7 +1367,7 @@ > if (JK_IS_DEBUG_LEVEL(l)) { > jk_log(l, JK_LOG_DEBUG, > "timeout during select on socket %d [%s] (timeout=%d)", >- sd, jk_dump_sinfo(sd, buf), timeout); >+ sd, jk_dump_sinfo(sd, buf, sizeof buf), timeout); > } > /* Timeout. Set the errno to timeout */ > #if defined(WIN32) || (defined(NETWARE) && defined(__NOVELL_LIBC__)) >@@ -1383,7 +1383,7 @@ > if (JK_IS_DEBUG_LEVEL(l)) { > jk_log(l, JK_LOG_DEBUG, > "error during select on socket %d [%s] (errno=%d)", >- sd, jk_dump_sinfo(sd, buf), errno); >+ sd, jk_dump_sinfo(sd, buf, sizeof buf), errno); > } > errno = save_errno; > JK_TRACE_EXIT(l); >Index: native/common/jk_connect.h >=================================================================== >--- native/common/jk_connect.h (revision 1589880) >+++ native/common/jk_connect.h (working copy) >@@ -57,7 +57,7 @@ > > char *jk_dump_hinfo(jk_sockaddr_t *saddr, char *buf); > >-char *jk_dump_sinfo(jk_sock_t sd, char *buf); >+char *jk_dump_sinfo(jk_sock_t sd, char *buf, const size_t size); > > int jk_is_input_event(jk_sock_t sd, int timeout, jk_logger_t *l); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 56452
: 31557