1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
--- snort-2.8.5.1.orig/src/log.c 2009-10-19 17:48:42.000000000 +0200
+++ snort-2.8.5.1/src/log.c 2009-12-27 17:19:26.000000000 +0100
@@ -362,7 +362,7 @@ void PrintIPPkt(FILE * fp, int type, Pac
DEBUG_WRAP(DebugMessage(DEBUG_LOG, "PrintIPPkt type = %d\n", type););
- bzero((char *) timestamp, TIMEBUF_SIZE);
+ memset((char *) timestamp, 0, TIMEBUF_SIZE);
ts_print((struct timeval *) & p->pkth->ts, timestamp);
/* dump the timestamp */
@@ -863,8 +863,8 @@ void PrintArpHeader(FILE * fp, Packet *
const uint8_t *mac_src = NULL;
const uint8_t *mac_dst = NULL;
- bzero((struct in_addr *) &ip_addr, sizeof(struct in_addr));
- bzero((char *) timestamp, TIMEBUF_SIZE);
+ memset((struct in_addr *) &ip_addr, 0, sizeof(struct in_addr));
+ memset((char *) timestamp, 0, TIMEBUF_SIZE);
ts_print((struct timeval *) & p->pkth->ts, timestamp);
/* determine what to use as MAC src and dst */
@@ -916,7 +916,7 @@ void PrintArpHeader(FILE * fp, Packet *
switch(ntohs(p->ah->ea_hdr.ar_op))
{
case ARPOP_REQUEST:
- bcopy((void *)p->ah->arp_tpa, (void *) &ip_addr, sizeof(ip_addr));
+ memcpy((void *) &ip_addr, (void *)p->ah->arp_tpa, sizeof(ip_addr));
fprintf(fp, "ARP who-has %s", inet_ntoa(ip_addr));
if(memcmp((char *) ezero, (char *) p->ah->arp_tha, 6) != 0)
@@ -925,7 +925,7 @@ void PrintArpHeader(FILE * fp, Packet *
p->ah->arp_tha[1], p->ah->arp_tha[2], p->ah->arp_tha[3],
p->ah->arp_tha[4], p->ah->arp_tha[5]);
}
- bcopy((void *)p->ah->arp_spa, (void *) &ip_addr, sizeof(ip_addr));
+ memcpy((void *) &ip_addr, (void *)p->ah->arp_spa, sizeof(ip_addr));
fprintf(fp, " tell %s", inet_ntoa(ip_addr));
@@ -938,7 +938,7 @@ void PrintArpHeader(FILE * fp, Packet *
break;
case ARPOP_REPLY:
- bcopy((void *)p->ah->arp_spa, (void *) &ip_addr, sizeof(ip_addr));
+ memcpy((void *) &ip_addr, (void *)p->ah->arp_spa, sizeof(ip_addr));
fprintf(fp, "ARP reply %s", inet_ntoa(ip_addr));
/* print out the originating request if we're on a weirder
@@ -971,7 +971,7 @@ void PrintArpHeader(FILE * fp, Packet *
break;
case ARPOP_RREPLY:
- bcopy((void *)p->ah->arp_tpa, (void *) &ip_addr, sizeof(ip_addr));
+ memcpy((void *) &ip_addr, (void *)p->ah->arp_tpa, sizeof(ip_addr));
fprintf(fp, "RARP reply %X:%X:%X:%X:%X:%X at %s",
p->ah->arp_tha[0], p->ah->arp_tha[1], p->ah->arp_tha[2],
p->ah->arp_tha[3], p->ah->arp_tha[4], p->ah->arp_tha[5],
@@ -1467,7 +1467,7 @@ void PrintICMPEmbeddedIP(FILE *fp, Packe
if (fp == NULL || p == NULL)
return;
- bzero((char *) &op, sizeof(Packet));
+ memset((char *) &op, 0, sizeof(Packet));
orig_p = &op;
orig_p->iph = p->orig_iph;
@@ -1717,7 +1717,7 @@ void PrintTcpOptions(FILE * fp, Packet *
switch(p->tcp_options[i].code)
{
case TCPOPT_MAXSEG:
- bzero((char *) tmp, 5);
+ memset((char *) tmp, 0, 5);
fwrite("MSS: ", 5, 1, fp);
if (p->tcp_options[i].data)
memcpy(tmp, p->tcp_options[i].data, 2);
@@ -1740,11 +1740,11 @@ void PrintTcpOptions(FILE * fp, Packet *
break;
case TCPOPT_SACK:
- bzero((char *) tmp, 5);
+ memset((char *) tmp, 0, 5);
if (p->tcp_options[i].data && (p->tcp_options[i].len >= 2))
memcpy(tmp, p->tcp_options[i].data, 2);
fprintf(fp, "Sack: %u@", EXTRACT_16BITS(tmp));
- bzero((char *) tmp, 5);
+ memset((char *) tmp, 0, 5);
if (p->tcp_options[i].data && (p->tcp_options[i].len >= 4))
memcpy(tmp, (p->tcp_options[i].data) + 2, 2);
fprintf(fp, "%u ", EXTRACT_16BITS(tmp));
@@ -1755,46 +1755,46 @@ void PrintTcpOptions(FILE * fp, Packet *
break;
case TCPOPT_ECHO:
- bzero((char *) tmp, 5);
+ memset((char *) tmp, 0, 5);
if (p->tcp_options[i].data)
memcpy(tmp, p->tcp_options[i].data, 4);
fprintf(fp, "Echo: %u ", EXTRACT_32BITS(tmp));
break;
case TCPOPT_ECHOREPLY:
- bzero((char *) tmp, 5);
+ memset((char *) tmp, 0, 5);
if (p->tcp_options[i].data)
memcpy(tmp, p->tcp_options[i].data, 4);
fprintf(fp, "Echo Rep: %u ", EXTRACT_32BITS(tmp));
break;
case TCPOPT_TIMESTAMP:
- bzero((char *) tmp, 5);
+ memset((char *) tmp, 0, 5);
if (p->tcp_options[i].data)
memcpy(tmp, p->tcp_options[i].data, 4);
fprintf(fp, "TS: %u ", EXTRACT_32BITS(tmp));
- bzero((char *) tmp, 5);
+ memset((char *) tmp, 0, 5);
if (p->tcp_options[i].data)
memcpy(tmp, (p->tcp_options[i].data) + 4, 4);
fprintf(fp, "%u ", EXTRACT_32BITS(tmp));
break;
case TCPOPT_CC:
- bzero((char *) tmp, 5);
+ memset((char *) tmp, 0, 5);
if (p->tcp_options[i].data)
memcpy(tmp, p->tcp_options[i].data, 4);
fprintf(fp, "CC %u ", EXTRACT_32BITS(tmp));
break;
case TCPOPT_CCNEW:
- bzero((char *) tmp, 5);
+ memset((char *) tmp, 0, 5);
if (p->tcp_options[i].data)
memcpy(tmp, p->tcp_options[i].data, 4);
fprintf(fp, "CCNEW: %u ", EXTRACT_32BITS(tmp));
break;
case TCPOPT_CCECHO:
- bzero((char *) tmp, 5);
+ memset((char *) tmp, 0, 5);
if (p->tcp_options[i].data)
memcpy(tmp, p->tcp_options[i].data, 4);
fprintf(fp, "CCECHO: %u ", EXTRACT_32BITS(tmp));
@@ -1944,7 +1944,7 @@ void PrintEapolPkt(FILE * fp, Packet * p
char timestamp[TIMEBUF_SIZE];
- bzero((char *) timestamp, TIMEBUF_SIZE);
+ memset((char *) timestamp, 0, TIMEBUF_SIZE);
ts_print((struct timeval *) & p->pkth->ts, timestamp);
/* dump the timestamp */
@@ -2118,7 +2118,7 @@ void PrintWifiPkt(FILE * fp, Packet * p)
char timestamp[TIMEBUF_SIZE];
- bzero((char *) timestamp, TIMEBUF_SIZE);
+ memset((char *) timestamp, 0, TIMEBUF_SIZE);
ts_print((struct timeval *) & p->pkth->ts, timestamp);
/* dump the timestamp */
|