diff options
author | 2018-11-25 15:31:12 +0000 | |
---|---|---|
committer | 2018-11-25 15:31:12 +0000 | |
commit | ce09f34338975b074cbe0f0ada2a9843ca1a36aa (patch) | |
tree | 65f8a0e0ec6904181ae7bf90e65badf9a41d1b78 | |
parent | don't bother with setresuid protection there is no gain doing (diff) | |
download | wireguard-openbsd-ce09f34338975b074cbe0f0ada2a9843ca1a36aa.tar.xz wireguard-openbsd-ce09f34338975b074cbe0f0ada2a9843ca1a36aa.zip |
malloc(n) + bzero is better done as calloc(1,n)
-rw-r--r-- | usr.sbin/bgpd/pftable.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/pftable.c b/usr.sbin/bgpd/pftable.c index 9766f1edfc3..418af987204 100644 --- a/usr.sbin/bgpd/pftable.c +++ b/usr.sbin/bgpd/pftable.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pftable.c,v 1.11 2018/09/20 11:06:04 benno Exp $ */ +/* $OpenBSD: pftable.c,v 1.12 2018/11/25 15:31:12 deraadt Exp $ */ /* * Copyright (c) 2004 Damien Miller <djm@openbsd.org> @@ -137,12 +137,11 @@ pftable_add(const char *name) if (strcmp(pft->name, name) == 0) return (0); - if ((pft = malloc(sizeof(*pft))) == NULL) { + if ((pft = calloc(1, sizeof(*pft))) == NULL) { log_warn("pftable malloc"); return (-1); } - bzero(pft, sizeof(*pft)); if (strlcpy(pft->name, name, sizeof(pft->name)) >= sizeof(pft->name)) { log_warn("pf_table name too long"); free(pft); |