2 ===================================================================
3 RCS file: /mnt/ncvs/src/contrib/tcpdump/addrtoname.c,v
4 retrieving revision 1.5
5 diff -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
10 tp->nxt = newhnamemem();
12 - (void)sprintf(buf, "%u", i);
13 + (void)snprintf(buf, sizeof(buf), "%u", i);
14 tp->name = savestr(buf);
21 - (void)sprintf(buf, "%d", port);
22 + (void)snprintf(buf, sizeof(buf), "%d", port);
23 table->name = savestr(buf);
25 table->name = savestr(sv->s_name);
27 ===================================================================
28 RCS file: /mnt/ncvs/src/contrib/tcpdump/print-atalk.c,v
29 retrieving revision 1.6
30 diff -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
35 register struct hnamemem *tp, *tp2;
36 register int i = (atnet << 8) | athost;
38 + char nambuf[MAXHOSTNAMELEN + 20];
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);
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 @@
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;
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");
74 ===================================================================
75 RCS file: /mnt/ncvs/src/contrib/tcpdump/print-icmp.c,v
76 retrieving revision 1.3
77 diff -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
81 register const struct ip *oip;
82 register const struct udphdr *ouh;
83 register u_int hlen, dport, mtu;
85 + char buf[MAXHOSTNAMELEN + 100];
87 dp = (struct icmp *)bp;
88 ip = (struct ip *)bp2;
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),
103 + (void)snprintf(buf, sizeof(buf),
104 "%s tcp port %s unreachable",
105 ipaddr_string(&oip->ip_dst),
106 tcpport_string(dport));
111 + (void)snprintf(buf, sizeof(buf),
112 "%s udp port %s unreachable",
113 ipaddr_string(&oip->ip_dst),
114 udpport_string(dport));
119 + (void)snprintf(buf, sizeof(buf),
120 "%s protocol %d port %d unreachable",
121 ipaddr_string(&oip->ip_dst),
123 @@ -234,11 +234,11 @@
124 mp = (struct mtu_discovery *)&dp->icmp_void;
125 mtu = EXTRACT_16BITS(&mp->nexthopmtu);
128 + (void)snprintf(buf, sizeof(buf),
129 "%s unreachable - need to frag (mtu %d)",
130 ipaddr_string(&dp->icmp_ip.ip_dst), mtu);
133 + (void)snprintf(buf, sizeof(buf),
134 "%s unreachable - need to frag",
135 ipaddr_string(&dp->icmp_ip.ip_dst));
139 fmt = tok2str(unreach2str, "#%d %%s unreachable",
141 - (void)sprintf(buf, fmt,
142 + (void)snprintf(buf, sizeof(buf), fmt,
143 ipaddr_string(&dp->icmp_ip.ip_dst));
147 TCHECK(dp->icmp_ip.ip_dst);
148 fmt = tok2str(type2str, "redirect-#%d %%s to net %%s",
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));
155 @@ -277,30 +277,30 @@
156 cp = buf + strlen(buf);
157 lifetime = EXTRACT_16BITS(&ihp->ird_lifetime);
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);
166 - (void)sprintf(cp, "%u:%02u:%02u",
167 + (void)snprintf(cp, sizeof(buf) - strlen(buf), "%u:%02u:%02u",
169 (lifetime % 3600) / 60,
171 cp = buf + strlen(buf);
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);
178 size = ihp->ird_addrsiz;
180 - (void)sprintf(cp, " [size %d]", size);
181 + (void)snprintf(cp, sizeof(buf) - strlen(buf), " [size %d]", size);
184 idp = (struct id_rdiscovery *)&dp->icmp_data;
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 @@
196 - (void)sprintf(buf, "time exceeded-#%d", dp->icmp_code);
197 + (void)snprintf(buf, sizeof(buf), "time exceeded-#%d", dp->icmp_code);
204 - (void)sprintf(buf, "parameter problem - code %d",
205 + (void)snprintf(buf, sizeof(buf), "parameter problem - code %d",
208 TCHECK(dp->icmp_pptr);
209 - (void)sprintf(buf, "parameter problem - octet %d",
210 + (void)snprintf(buf, sizeof(buf), "parameter problem - octet %d",
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));
222 Index: print-sunrpc.c
223 ===================================================================
224 RCS file: /mnt/ncvs/src/contrib/tcpdump/print-sunrpc.c,v
225 retrieving revision 1.4
226 diff -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
230 rp = getrpcbynumber(prog);
232 (void) sprintf(buf, "#%u", prog);
234 - strcpy(buf, rp->r_name);
236 + strncpy(buf, rp->r_name, sizeof(buf)-1);
237 + buf[sizeof(buf)-1] = '\0';
242 ===================================================================
243 RCS file: /mnt/ncvs/src/contrib/tcpdump/util.c,v
244 retrieving revision 1.1.1.3
245 diff -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
252 - (void)sprintf(buf, fmt, v);
253 + (void)snprintf(buf, sizeof(buf), fmt, v);