aboutsummaryrefslogtreecommitdiffstats
path: root/pcap-dlpi.c
diff options
context:
space:
mode:
authoritojun <itojun>2000-04-27 11:16:19 +0000
committeritojun <itojun>2000-04-27 11:16:19 +0000
commit6abf10866e492d3cf72df894e0551f59ee4d832e (patch)
treedf3cb342e2f511b5073e7d7daee1a22db8708952 /pcap-dlpi.c
parentd2268605b4c5f8e21b0dec876cd5c5037e01c4af (diff)
nuke strcpy()
Diffstat (limited to 'pcap-dlpi.c')
-rw-r--r--pcap-dlpi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/pcap-dlpi.c b/pcap-dlpi.c
index 24edbce..84ea338 100644
--- a/pcap-dlpi.c
+++ b/pcap-dlpi.c
@@ -38,7 +38,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.54 2000-04-27 09:11:13 itojun Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.55 2000-04-27 11:16:19 itojun Exp $ (LBL)";
#endif
#include <sys/types.h>
@@ -159,7 +159,8 @@ pcap_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
cc = 0;
continue;
}
- strcpy(p->errbuf, pcap_strerror(errno));
+ strlcpy(p->errbuf, pcap_strerror(errno),
+ sizeof(p->errbuf));
return (-1);
}
cc = data.len;
@@ -241,7 +242,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
p = (pcap_t *)malloc(sizeof(*p));
if (p == NULL) {
- strcpy(ebuf, pcap_strerror(errno));
+ strlcpy(ebuf, pcap_strerror(errno), PCAP_ERRBUFF_SIZE);
return (NULL);
}
memset(p, 0, sizeof(*p));
@@ -263,7 +264,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
}
if (*device == '/')
- strcpy(dname, device);
+ strlcpy(dname, device, sizeof(dname));
else {
snprintf(dname, sizeof(dname),
"%s/%s", PCAP_DEV_PREFIX, device);
@@ -282,7 +283,7 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
goto bad;
#else
/* Try device without unit number */
- strcpy(dname2, dname);
+ strlcpy(dname2, dname, sizeof(dname2));
cp = strchr(dname, *cp);
*cp = '\0';
if ((p->fd = open(dname, O_RDWR)) < 0) {