summaryrefslogtreecommitdiff
path: root/usr.sbin/bootp
diff options
context:
space:
mode:
authoritojun <itojun@NetBSD.org>2003-07-14 08:36:34 +0000
committeritojun <itojun@NetBSD.org>2003-07-14 08:36:34 +0000
commit47a6a58fe58184f826655cf94cffbb25e047ef83 (patch)
tree859c8e17d2701e0ba056ff0e5e6ffbbc9115d5dd /usr.sbin/bootp
parent7b8c272d80260b9423934210b28c7d96ad13733b (diff)
use bounded string op
Diffstat (limited to 'usr.sbin/bootp')
-rw-r--r--usr.sbin/bootp/bootptest/getether.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/bootp/bootptest/getether.c b/usr.sbin/bootp/bootptest/getether.c
index 148e7edce90..2ecd2807e62 100644
--- a/usr.sbin/bootp/bootptest/getether.c
+++ b/usr.sbin/bootp/bootptest/getether.c
@@ -1,8 +1,8 @@
-/* $NetBSD: getether.c,v 1.6 2002/07/14 00:30:02 wiz Exp $ */
+/* $NetBSD: getether.c,v 1.7 2003/07/14 08:36:34 itojun Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: getether.c,v 1.6 2002/07/14 00:30:02 wiz Exp $");
+__RCSID("$NetBSD: getether.c,v 1.7 2003/07/14 08:36:34 itojun Exp $");
#endif
/*
@@ -47,8 +47,9 @@ getether(char *ifname, char *eap)
int rc = -1;
int fd;
struct ifdevea phys;
+
bzero(&phys, sizeof(phys));
- strcpy(phys.ifr_name, ifname);
+ strncpy(phys.ifr_name, ifname, sizeof(phys.ifr_name));
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
report(LOG_ERR, "getether: socket(INET,DGRAM) failed");
return -1;
@@ -197,7 +198,7 @@ getether(char *ifname, char *eap)
char *enaddr;
int unit = -1; /* which unit to attach */
- sprintf(devname, "/dev/%s", ifname);
+ snprintf(devname, sizeof(devname), "/dev/%s", ifname);
fd = open(devname, 2);
if (fd < 0) {
/* Try without the trailing digit. */
@@ -342,8 +343,9 @@ getether(char *ifname, char *eap)
int rc = -1;
int fd;
struct ifreq phys;
+
bzero(&phys, sizeof(phys));
- strcpy(phys.ifr_name, ifname);
+ strncpy(phys.ifr_name, ifname, sizeof(phys.ifr_name));
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
report(LOG_ERR, "getether: socket(INET,DGRAM) failed");
return -1;