diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-06-28 23:55:48 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-06-28 23:55:48 +0000 |
commit | e206b9b0c585bd1162ea7220c866b98805deccdf (patch) | |
tree | f2912c76826276eb42d342b97f3a644f7bfa9e2c /usr.sbin/rbootd/bpf.c | |
parent | deb044f179a6a4cdfcedd6199d6465e67a7e42c4 (diff) |
buf oflow safe
Diffstat (limited to 'usr.sbin/rbootd/bpf.c')
-rw-r--r-- | usr.sbin/rbootd/bpf.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/rbootd/bpf.c b/usr.sbin/rbootd/bpf.c index aae7d173a09..7fff787ff4f 100644 --- a/usr.sbin/rbootd/bpf.c +++ b/usr.sbin/rbootd/bpf.c @@ -235,7 +235,7 @@ BpfGetIntfName(errmsg) *errmsg = errbuf; if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - (void) strcpy(errbuf, "bpf: socket: %m"); + (void) strlcpy(errbuf, sizeof(errbuf), "bpf: socket: %m"); return(NULL); } ifc.ifc_len = sizeof ibuf; @@ -244,13 +244,15 @@ BpfGetIntfName(errmsg) #ifdef OSIOCGIFCONF if (ioctl(fd, OSIOCGIFCONF, (char *)&ifc) < 0 || ifc.ifc_len < sizeof(struct ifreq)) { - (void) strcpy(errbuf, "bpf: ioctl(OSIOCGIFCONF): %m"); + (void) strlcpy(errbuf, sizeof (errbuf), + "bpf: ioctl(OSIOCGIFCONF): %m"); return(NULL); } #else if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 || ifc.ifc_len < sizeof(struct ifreq)) { - (void) strcpy(errbuf, "bpf: ioctl(SIOCGIFCONF): %m"); + (void) strlcpy(errbuf, sizeof(errbuf), + "bpf: ioctl(SIOCGIFCONF): %m"); return(NULL); } #endif @@ -261,7 +263,8 @@ BpfGetIntfName(errmsg) minunit = 666; for (; ifrp < ifend; ++ifrp) { if (ioctl(fd, SIOCGIFFLAGS, (char *)ifrp) < 0) { - (void) strcpy(errbuf, "bpf: ioctl(SIOCGIFFLAGS): %m"); + (void) strlcpy(errbuf, sizeof(errbuf), + "bpf: ioctl(SIOCGIFFLAGS): %m"); return(NULL); } @@ -288,7 +291,8 @@ BpfGetIntfName(errmsg) (void) close(fd); if (mp == 0) { - (void) strcpy(errbuf, "bpf: no interfaces found"); + (void) strlcpy(errbuf, sizeof(errbuf), + "bpf: no interfaces found"); return(NULL); } |