diff options
author | Mike Frantzen <frantzen@cvs.openbsd.org> | 2004-06-29 17:40:19 +0000 |
---|---|---|
committer | Mike Frantzen <frantzen@cvs.openbsd.org> | 2004-06-29 17:40:19 +0000 |
commit | 744fae1bc742aef3083f4a9599be4ef2e241964e (patch) | |
tree | b6c593047b319fceaf71f80ac25c6301c2957e9a /sbin/pfctl/parse.y | |
parent | 9e371e057e22115c3bce464fe787d375ed2e33bd (diff) |
convert a few memcpy()s to strlcpy() so we don't copy uninitialized junk into
a interface name's slack space past the \0. will be needed for the optimizer.
ok henning@
Diffstat (limited to 'sbin/pfctl/parse.y')
-rw-r--r-- | sbin/pfctl/parse.y | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 6bde77f951f..a1578f49e8f 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.457 2004/06/26 07:25:16 david Exp $ */ +/* $OpenBSD: parse.y,v 1.458 2004/06/29 17:40:18 frantzen Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -4181,11 +4181,12 @@ expand_rule(struct pf_rule *r, r->af = dst_host->af; if (*interface->ifname) - memcpy(r->ifname, interface->ifname, sizeof(r->ifname)); + strlcpy(r->ifname, interface->ifname, + sizeof(r->ifname)); else if (if_indextoname(src_host->ifindex, ifname)) - memcpy(r->ifname, ifname, sizeof(r->ifname)); + strlcpy(r->ifname, ifname, sizeof(r->ifname)); else if (if_indextoname(dst_host->ifindex, ifname)) - memcpy(r->ifname, ifname, sizeof(r->ifname)); + strlcpy(r->ifname, ifname, sizeof(r->ifname)); else memset(r->ifname, '\0', sizeof(r->ifname)); |