diff options
author | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2009-01-29 13:12:22 +0000 |
---|---|---|
committer | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2009-01-29 13:12:22 +0000 |
commit | c83d3ec33655ba4767b50cbe07a413e4f838bdcb (patch) | |
tree | c3162b7b7aecade98f1198ed90c753f600dbe0f1 | |
parent | 5a25b381ab24b54d80c9c0d649ce2ce097e39267 (diff) |
detect truncation with strlcpy, not strlen.
ok mbalmer@
-rw-r--r-- | usr.sbin/wake/wake.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/wake/wake.c b/usr.sbin/wake/wake.c index bd18ebd8a13..a205e46d810 100644 --- a/usr.sbin/wake/wake.c +++ b/usr.sbin/wake/wake.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wake.c,v 1.6 2009/01/29 13:10:39 pyr Exp $ */ +/* $OpenBSD: wake.c,v 1.7 2009/01/29 13:12:21 pyr Exp $ */ /* * Copyright (C) 2006-2008 Marc Balmer. @@ -125,9 +125,9 @@ bind_if_to_bpf(char const *ifname, int bpf) struct ifreq ifr; u_int dlt; - if (strlen(ifname) >= sizeof(ifr.ifr_name)) + if (strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)) >= + sizeof(ifr.ifr_name)) return -1; - strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(bpf, BIOCSETIF, &ifr) == -1) return -1; if (ioctl(bpf, BIOCGDLT, &dlt) == -1) |