From 75cfc95fe29409b16bf565117a176395b3b274c9 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Sat, 27 Apr 1996 18:19:12 +0000 Subject: [PATCH] inet_ntoa buffer was evaluated twice in log_in_vain, fix it. Thanx to: jdp --- sys/netinet/tcp_input.c | 10 +++++++--- sys/netinet/tcp_reass.c | 10 +++++++--- sys/netinet/udp_usrreq.c | 10 +++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 9132b338072e..17cfd32f0719 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 - * $Id: tcp_input.c,v 1.42 1996/04/09 07:01:51 pst Exp $ + * $Id: tcp_input.c,v 1.43 1996/04/26 18:32:57 wollman Exp $ */ #ifndef TUBA_INCLUDE @@ -377,11 +377,15 @@ findpcb: * but should either do a listen or a connect soon. */ if (inp == NULL) { - if (log_in_vain && tiflags & TH_SYN) + if (log_in_vain && tiflags & TH_SYN) { + char buf[4*sizeof "123"]; + + strcpy(buf, inet_ntoa(ti->ti_dst)); log(LOG_INFO, "Connection attempt to TCP %s:%d" " from %s:%d\n", - inet_ntoa(ti->ti_dst), ntohs(ti->ti_dport), + buf, ntohs(ti->ti_dport), inet_ntoa(ti->ti_src), ntohs(ti->ti_sport)); + } goto dropwithreset; } tp = intotcpcb(inp); diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 9132b338072e..17cfd32f0719 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 - * $Id: tcp_input.c,v 1.42 1996/04/09 07:01:51 pst Exp $ + * $Id: tcp_input.c,v 1.43 1996/04/26 18:32:57 wollman Exp $ */ #ifndef TUBA_INCLUDE @@ -377,11 +377,15 @@ findpcb: * but should either do a listen or a connect soon. */ if (inp == NULL) { - if (log_in_vain && tiflags & TH_SYN) + if (log_in_vain && tiflags & TH_SYN) { + char buf[4*sizeof "123"]; + + strcpy(buf, inet_ntoa(ti->ti_dst)); log(LOG_INFO, "Connection attempt to TCP %s:%d" " from %s:%d\n", - inet_ntoa(ti->ti_dst), ntohs(ti->ti_dport), + buf, ntohs(ti->ti_dport), inet_ntoa(ti->ti_src), ntohs(ti->ti_sport)); + } goto dropwithreset; } tp = intotcpcb(inp); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 220b976a51b1..dd8fd6e88d8f 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 - * $Id: udp_usrreq.c,v 1.21 1996/04/04 10:46:44 phk Exp $ + * $Id: udp_usrreq.c,v 1.22 1996/04/09 07:01:53 pst Exp $ */ #include @@ -279,11 +279,15 @@ udp_input(m, iphlen) uh->uh_dport, INPLOOKUP_WILDCARD); } if (inp == NULL) { - if (log_in_vain) + if (log_in_vain) { + char buf[4*sizeof "123"]; + + strcpy(buf, inet_ntoa(ip->ip_dst)); log(LOG_INFO, "Connection attempt to UDP %s:%d" " from %s:%d\n", - inet_ntoa(ip->ip_dst), ntohs(uh->uh_dport), + buf, ntohs(uh->uh_dport), inet_ntoa(ip->ip_src), ntohs(uh->uh_sport)); + } udpstat.udps_noport++; if (m->m_flags & (M_BCAST | M_MCAST)) { udpstat.udps_noportbcast++;