]> git.pld-linux.org Git - packages/tcpdump.git/blame - tcpdump-4.x.patch
- release 2,
[packages/tcpdump.git] / tcpdump-4.x.patch
CommitLineData
ba63cb11
AM
1Index: addrtoname.c
2===================================================================
3RCS file: /mnt/ncvs/src/contrib/tcpdump/addrtoname.c,v
4retrieving revision 1.5
5diff -u -r1.5 addrtoname.c
6--- addrtoname.c 1998/09/15 19:46:59 1.5
7+++ addrtoname.c 2000/10/30 10:28:54
8@@ -525,7 +525,7 @@
9 tp->addr = i;
10 tp->nxt = newhnamemem();
11
12- (void)sprintf(buf, "%u", i);
13+ (void)snprintf(buf, sizeof(buf), "%u", i);
14 tp->name = savestr(buf);
15 return (tp->name);
16 }
17@@ -551,7 +551,7 @@
18 while (table->name)
19 table = table->nxt;
20 if (nflag) {
21- (void)sprintf(buf, "%d", port);
22+ (void)snprintf(buf, sizeof(buf), "%d", port);
23 table->name = savestr(buf);
24 } else
25 table->name = savestr(sv->s_name);
26Index: print-atalk.c
27===================================================================
28RCS file: /mnt/ncvs/src/contrib/tcpdump/print-atalk.c,v
29retrieving revision 1.6
30diff -u -r1.6 print-atalk.c
31--- print-atalk.c 1998/09/15 19:46:59 1.6
32+++ print-atalk.c 2000/10/30 10:28:54
33@@ -495,7 +495,7 @@
34 {
35 register struct hnamemem *tp, *tp2;
36 register int i = (atnet << 8) | athost;
37- char nambuf[256];
38+ char nambuf[MAXHOSTNAMELEN + 20];
39 static int first = 1;
40 FILE *fp;
41
42@@ -540,7 +540,7 @@
43 if (tp2->addr == i) {
44 tp->addr = (atnet << 8) | athost;
45 tp->nxt = newhnamemem();
46- (void)sprintf(nambuf, "%s.%d", tp2->name, athost);
47+ (void)snprintf(nambuf, sizeof(nambuf), "%s.%d", tp2->name, athost);
48 tp->name = savestr(nambuf);
49 return (tp->name);
50 }
51;Index: print-fr.c
52;===================================================================
53;RCS file: /mnt/ncvs/src/contrib/tcpdump/print-fr.c,v
54;retrieving revision 1.2
55;diff -u -r1.2 print-fr.c
56;--- print-fr.c 1998/01/01 04:13:43 1.2
57;+++ print-fr.c 2000/10/30 10:28:58
58;@@ -395,12 +395,12 @@
59; break;
60; case LINK_VERIFY_IE_91:
61; case LINK_VERIFY_IE_94:
62;- sprintf(temp_str,"TX Seq: %3d, RX Seq: %3d",
63;+ snprintf(temp_str, sizeof(temp_str), "TX Seq: %3d, RX Seq: %3d",
64; ptemp[2], ptemp[3]);
65; decode_str = temp_str;
66; break;
67; case PVC_STATUS_IE:
68;- sprintf(temp_str,"DLCI %d: status %s %s",
69;+ snprintf(temp_str,sizeof(temp_str), "DLCI %d: status %s %s",
70; ((ptemp[2]&0x3f)<<4)+ ((ptemp[3]&0x78)>>3),
71; ptemp[4] & 0x8 ?"new,":" ",
72; ptemp[4] & 0x2 ?"Active":"Inactive");
73Index: print-icmp.c
74===================================================================
75RCS file: /mnt/ncvs/src/contrib/tcpdump/print-icmp.c,v
76retrieving revision 1.3
77diff -u -r1.3 print-icmp.c
78--- print-icmp.c 1997/05/27 02:17:32 1.3
79+++ print-icmp.c 2000/10/30 10:28:58
80@@ -172,7 +172,7 @@
81 register const struct ip *oip;
82 register const struct udphdr *ouh;
83 register u_int hlen, dport, mtu;
84- char buf[256];
85+ char buf[MAXHOSTNAMELEN + 100];
86
87 dp = (struct icmp *)bp;
88 ip = (struct ip *)bp2;
89@@ -191,7 +191,7 @@
90
91 case ICMP_UNREACH_PROTOCOL:
92 TCHECK(dp->icmp_ip.ip_p);
93- (void)sprintf(buf, "%s protocol %d unreachable",
94+ (void)snprintf(buf, sizeof(buf), "%s protocol %d unreachable",
95 ipaddr_string(&dp->icmp_ip.ip_dst),
96 dp->icmp_ip.ip_p);
97 break;
98@@ -205,21 +205,21 @@
99 switch (oip->ip_p) {
100
101 case IPPROTO_TCP:
102- (void)sprintf(buf,
103+ (void)snprintf(buf, sizeof(buf),
104 "%s tcp port %s unreachable",
105 ipaddr_string(&oip->ip_dst),
106 tcpport_string(dport));
107 break;
108
109 case IPPROTO_UDP:
110- (void)sprintf(buf,
111+ (void)snprintf(buf, sizeof(buf),
112 "%s udp port %s unreachable",
113 ipaddr_string(&oip->ip_dst),
114 udpport_string(dport));
115 break;
116
117 default:
118- (void)sprintf(buf,
119+ (void)snprintf(buf, sizeof(buf),
120 "%s protocol %d port %d unreachable",
121 ipaddr_string(&oip->ip_dst),
122 oip->ip_p, dport);
123@@ -234,11 +234,11 @@
124 mp = (struct mtu_discovery *)&dp->icmp_void;
125 mtu = EXTRACT_16BITS(&mp->nexthopmtu);
126 if (mtu)
127- (void)sprintf(buf,
128+ (void)snprintf(buf, sizeof(buf),
129 "%s unreachable - need to frag (mtu %d)",
130 ipaddr_string(&dp->icmp_ip.ip_dst), mtu);
131 else
132- (void)sprintf(buf,
133+ (void)snprintf(buf, sizeof(buf),
134 "%s unreachable - need to frag",
135 ipaddr_string(&dp->icmp_ip.ip_dst));
136 }
137@@ -247,7 +247,7 @@
138 default:
139 fmt = tok2str(unreach2str, "#%d %%s unreachable",
140 dp->icmp_code);
141- (void)sprintf(buf, fmt,
142+ (void)snprintf(buf, sizeof(buf), fmt,
143 ipaddr_string(&dp->icmp_ip.ip_dst));
144 break;
145 }
146@@ -257,7 +257,7 @@
147 TCHECK(dp->icmp_ip.ip_dst);
148 fmt = tok2str(type2str, "redirect-#%d %%s to net %%s",
149 dp->icmp_code);
150- (void)sprintf(buf, fmt,
151+ (void)snprintf(buf, sizeof(buf), fmt,
152 ipaddr_string(&dp->icmp_ip.ip_dst),
153 ipaddr_string(&dp->icmp_gwaddr));
154 break;
155@@ -277,30 +277,30 @@
156 cp = buf + strlen(buf);
157 lifetime = EXTRACT_16BITS(&ihp->ird_lifetime);
158 if (lifetime < 60)
159- (void)sprintf(cp, "%u", lifetime);
160+ (void)snprintf(cp, sizeof(buf) - strlen(buf), "%u", lifetime);
161 else if (lifetime < 60 * 60)
162- (void)sprintf(cp, "%u:%02u",
163+ (void)snprintf(cp, sizeof(buf) - strlen(buf), "%u:%02u",
164 lifetime / 60, lifetime % 60);
165 else
166- (void)sprintf(cp, "%u:%02u:%02u",
167+ (void)snprintf(cp, sizeof(buf) - strlen(buf), "%u:%02u:%02u",
168 lifetime / 3600,
169 (lifetime % 3600) / 60,
170 lifetime % 60);
171 cp = buf + strlen(buf);
172
173 num = ihp->ird_addrnum;
174- (void)sprintf(cp, " %d:", num);
175+ (void)snprintf(cp, sizeof(buf) - strlen(buf), " %d:", num);
176 cp = buf + strlen(buf);
177
178 size = ihp->ird_addrsiz;
179 if (size != 2) {
180- (void)sprintf(cp, " [size %d]", size);
181+ (void)snprintf(cp, sizeof(buf) - strlen(buf), " [size %d]", size);
182 break;
183 }
184 idp = (struct id_rdiscovery *)&dp->icmp_data;
185 while (num-- > 0) {
186 TCHECK(*idp);
187- (void)sprintf(cp, " {%s %u}",
188+ (void)snprintf(cp, sizeof(buf) - strlen(buf), " {%s %u}",
189 ipaddr_string(&idp->ird_addr),
190 EXTRACT_32BITS(&idp->ird_pref));
191 cp = buf + strlen(buf);
192@@ -321,25 +321,25 @@
193 break;
194
195 default:
196- (void)sprintf(buf, "time exceeded-#%d", dp->icmp_code);
197+ (void)snprintf(buf, sizeof(buf), "time exceeded-#%d", dp->icmp_code);
198 break;
199 }
200 break;
201
202 case ICMP_PARAMPROB:
203 if (dp->icmp_code)
204- (void)sprintf(buf, "parameter problem - code %d",
205+ (void)snprintf(buf, sizeof(buf), "parameter problem - code %d",
206 dp->icmp_code);
207 else {
208 TCHECK(dp->icmp_pptr);
209- (void)sprintf(buf, "parameter problem - octet %d",
210+ (void)snprintf(buf, sizeof(buf), "parameter problem - octet %d",
211 dp->icmp_pptr);
212 }
213 break;
214
215 case ICMP_MASKREPLY:
216 TCHECK(dp->icmp_mask);
217- (void)sprintf(buf, "address mask is 0x%08x",
218+ (void)snprintf(buf, sizeof(buf), "address mask is 0x%08x",
219 (u_int32_t)ntohl(dp->icmp_mask));
220 break;
221
222Index: print-sunrpc.c
223===================================================================
224RCS file: /mnt/ncvs/src/contrib/tcpdump/print-sunrpc.c,v
225retrieving revision 1.4
226diff -u -r1.4 print-sunrpc.c
227--- print-sunrpc.c 1998/09/15 19:46:59 1.4
228+++ print-sunrpc.c 2000/10/30 10:28:59
229@@ -126,7 +126,9 @@
230 rp = getrpcbynumber(prog);
231 if (rp == NULL)
232 (void) sprintf(buf, "#%u", prog);
233- else
234- strcpy(buf, rp->r_name);
235+ else {
236+ strncpy(buf, rp->r_name, sizeof(buf)-1);
237+ buf[sizeof(buf)-1] = '\0';
238+ }
239 return (buf);
240 }
241Index: util.c
242===================================================================
243RCS file: /mnt/ncvs/src/contrib/tcpdump/util.c,v
244retrieving revision 1.1.1.3
245diff -u -r1.1.1.3 util.c
246--- util.c 1998/09/15 19:36:31 1.1.1.3
247+++ util.c 2000/10/30 10:29:01
248@@ -154,7 +154,7 @@
249 }
250 if (fmt == NULL)
251 fmt = "#%d";
252- (void)sprintf(buf, fmt, v);
253+ (void)snprintf(buf, sizeof(buf), fmt, v);
254 return (buf);
255 }
256
This page took 0.055367 seconds and 4 git commands to generate.