inet_ntoa buffer was evaluated twice in log_in_vain, fix it.

Thanx to: jdp
This commit is contained in:
Andrey A. Chernov 1996-04-27 18:19:12 +00:00
parent d5d7648201
commit 75cfc95fe2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15414
3 changed files with 21 additions and 9 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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 <sys/param.h>
@ -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++;