[tpop3d-discuss]Found bug in netloop.c with TCP_WRAPPERS
Boris Kovalenko
boris at tagnet.ru
Sun, 13 Mar 2005 11:40:55 +0500
This is a multi-part message in MIME format.
--------------080104070703010303040200
Content-Type: text/plain; charset=KOI8-R; format=flowed
Content-Transfer-Encoding: 7bit
Hello!
Bug isn't critical, but should be fixed. The string returned by
inet_ntoa() resides in a static memory area, so line
log_print(LOG_ERR, "net_loop: tcp_wrappers: connection from %s to local
address %s:%d refused", inet_ntoa(sin.sin_addr),
inet_ntoa(sinlocal.sin_addr), htons(sinlocal.sin_port));
is incorrect. The patch attached fixes this problem, but it is "dirty"
and probably should be recoded.
With respect,
Boris Kovalenko
--------------080104070703010303040200
Content-Type: text/plain;
name="netloop.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="netloop.diff"
--- netloop.c.orig Tue Nov 25 00:58:28 2003
+++ netloop.c Sun Mar 13 11:37:57 2005
@@ -140,7 +140,11 @@
#ifdef USE_TCP_WRAPPERS
else if (!hosts_ctl(tcpwrappersname, STRING_UNKNOWN, inet_ntoa(sin.sin_addr), STRING_UNKNOWN)) {
- log_print(LOG_ERR, "net_loop: tcp_wrappers: connection from %s to local address %s:%d refused", inet_ntoa(sin.sin_addr), inet_ntoa(sinlocal.sin_addr), htons(sinlocal.sin_port));
+ char l_addr[16], r_addr[16];
+
+ strcpy(r_addr, inet_ntoa(sin.sin_addr));
+ strcpy(l_addr, inet_ntoa(sinlocal.sin_addr));
+ log_print(LOG_ERR, "net_loop: tcp_wrappers: connection from %s to local address %s:%d refused", r_addr, l_addr, htons(sinlocal.sin_port));
close(s);
}
#endif
--------------080104070703010303040200--