[Snort-devel] One more inet_ntoa bug

Paul Cardon paul at ...186...
Sat Jan 13 16:40:54 EST 2001


Checked through all uses of inet_ntoa and found one more *printf in
spp_anomsensor.c with inet_ntoa used twice in the argument list.  The
patch is attached.

-paul
-------------- next part --------------
--- spp_anomsensor.c.orig	Tue Jan  2 03:06:01 2001
+++ spp_anomsensor.c	Sat Jan 13 15:38:41 2001
@@ -1508,6 +1508,8 @@
 }
 
 void record_packet(Packet *p,valtype val[]) {
+	char sip[16];
+	char dip[16];
 	recent_packets++;
 	tot_packets++;
 	val[SIP]= p->iph->ip_src.s_addr;
@@ -1517,7 +1519,11 @@
 	//val[TTL]= p->iph->ip_ttl;
 	//val[WIN] = p->tcph->th_win;
 	
-	if (as_debug > 2) printf("adding %s, %s, %d, %d\n",inet_ntoa(p->iph->ip_src),inet_ntoa(p->iph->ip_dst),val[SPORT],val[DPORT]);
+	if (as_debug > 2) {
+		strncpy(sip, inet_ntoa(p->iph->ip_src), 16);
+		strncpy(dip, inet_ntoa(p->iph->ip_dst), 16);
+		printf("adding %s, %s, %d, %d\n",sip,dip,val[SPORT],val[DPORT]);
+	}
 	if (parts) {
 		if (part == 0) {
 			/* full all at once */



More information about the Snort-devel mailing list