From: claudio Date: Wed, 17 Aug 2022 15:16:12 +0000 (+0000) Subject: Use memset() instead of bzero(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4a99c7448f02242f55ec4f1fb6bc429d7ebccce9;p=openbsd Use memset() instead of bzero(). OK tb@ deraadt@ --- diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index deca860f36c..fbdf53e2887 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.281 2022/07/28 10:40:25 claudio Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.282 2022/08/17 15:16:12 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -131,7 +131,7 @@ main(int argc, char *argv[]) if (pledge("stdio", NULL) == -1) err(1, "pledge"); - bzero(&ribreq, sizeof(ribreq)); + memset(&ribreq, 0, sizeof(ribreq)); if (res->as.type != AS_UNDEF) ribreq.as = res->as; if (res->addr.aid) { @@ -160,7 +160,7 @@ main(int argc, char *argv[]) if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) err(1, "control_init: socket"); - bzero(&sa_un, sizeof(sa_un)); + memset(&sa_un, 0, sizeof(sa_un)); sa_un.sun_family = AF_UNIX; if (strlcpy(sa_un.sun_path, sockname, sizeof(sa_un.sun_path)) >= sizeof(sa_un.sun_path)) @@ -235,7 +235,7 @@ main(int argc, char *argv[]) NULL, 0); break; case SHOW_RIB: - bzero(&ribreq, sizeof(ribreq)); + memset(&ribreq, 0, sizeof(ribreq)); type = IMSG_CTL_SHOW_RIB; if (res->addr.aid) { ribreq.prefix = res->addr; @@ -310,7 +310,7 @@ main(int argc, char *argv[]) break; case NETWORK_ADD: case NETWORK_REMOVE: - bzero(&net, sizeof(net)); + memset(&net, 0, sizeof(net)); net.prefix = res->addr; net.prefixlen = res->prefixlen; net.rd = res->rd; @@ -333,14 +333,14 @@ main(int argc, char *argv[]) done = 1; break; case NETWORK_SHOW: - bzero(&ribreq, sizeof(ribreq)); + memset(&ribreq, 0, sizeof(ribreq)); ribreq.aid = res->aid; strlcpy(ribreq.rib, res->rib, sizeof(ribreq.rib)); imsg_compose(ibuf, IMSG_CTL_SHOW_NETWORK, 0, 0, -1, &ribreq, sizeof(ribreq)); break; case NETWORK_MRT: - bzero(&ribreq, sizeof(ribreq)); + memset(&ribreq, 0, sizeof(ribreq)); if (res->as.type != AS_UNDEF) ribreq.as = res->as; if (res->addr.aid) { @@ -1076,7 +1076,7 @@ network_bulk(struct parse_result *res) /* Stop processing after a comment */ if (*b == '#') break; - bzero(&net, sizeof(net)); + memset(&net, 0, sizeof(net)); if (parse_prefix(b, strlen(b), &h, &len) != 1) errx(1, "bad prefix: %s", b); net.prefix = h; @@ -1145,7 +1145,7 @@ show_mrt_dump(struct mrt_rib *mr, struct mrt_peer *mp, void *arg) for (i = 0; i < mr->nentries; i++) { mre = &mr->entries[i]; - bzero(&ctl, sizeof(ctl)); + memset(&ctl, 0, sizeof(ctl)); ctl.prefix = mr->prefix; ctl.prefixlen = mr->prefixlen; if (mre->originated <= now) @@ -1228,7 +1228,7 @@ network_mrt_dump(struct mrt_rib *mr, struct mrt_peer *mp, void *arg) now = time(NULL); for (i = 0; i < mr->nentries; i++) { mre = &mr->entries[i]; - bzero(&ctl, sizeof(ctl)); + memset(&ctl, 0, sizeof(ctl)); ctl.prefix = mr->prefix; ctl.prefixlen = mr->prefixlen; if (mre->originated <= now) @@ -1269,7 +1269,7 @@ network_mrt_dump(struct mrt_rib *mr, struct mrt_peer *mp, void *arg) !match_aspath(mre->aspath, mre->aspath_len, &req->as)) continue; - bzero(&net, sizeof(net)); + memset(&net, 0, sizeof(net)); net.prefix = ctl.prefix; net.prefixlen = ctl.prefixlen; net.type = NETWORK_MRTCLONE; diff --git a/usr.sbin/bgpctl/mrtparser.c b/usr.sbin/bgpctl/mrtparser.c index 9e77739c196..8d9ae8f8235 100644 --- a/usr.sbin/bgpctl/mrtparser.c +++ b/usr.sbin/bgpctl/mrtparser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mrtparser.c,v 1.17 2022/02/06 09:52:32 claudio Exp $ */ +/* $OpenBSD: mrtparser.c,v 1.18 2022/08/17 15:16:12 claudio Exp $ */ /* * Copyright (c) 2011 Claudio Jeker * @@ -58,7 +58,7 @@ mrt_read_msg(int fd, struct mrt_hdr *hdr) { void *buf; - bzero(hdr, sizeof(*hdr)); + memset(hdr, 0, sizeof(*hdr)); if (mrt_read_buf(fd, hdr, sizeof(*hdr)) != sizeof(*hdr)) return (NULL); diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c index ce861f6979b..00682ff12b8 100644 --- a/usr.sbin/bgpctl/parser.c +++ b/usr.sbin/bgpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.113 2022/06/22 12:27:46 claudio Exp $ */ +/* $OpenBSD: parser.c,v 1.114 2022/08/17 15:16:12 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -506,7 +506,7 @@ parse(int argc, char *argv[]) const struct token *table = t_main; const struct token *match; - bzero(&res, sizeof(res)); + memset(&res, 0, sizeof(res)); res.rtableid = getrtable(); TAILQ_INIT(&res.set); @@ -907,8 +907,8 @@ parse_addr(const char *word, struct bgpd_addr *addr) if (word == NULL) return (0); - bzero(addr, sizeof(struct bgpd_addr)); - bzero(&ina, sizeof(ina)); + memset(addr, 0, sizeof(struct bgpd_addr)); + memset(&ina, 0, sizeof(ina)); if (inet_net_pton(AF_INET, word, &ina, sizeof(ina)) != -1) { addr->aid = AID_INET; @@ -916,7 +916,7 @@ parse_addr(const char *word, struct bgpd_addr *addr) return (1); } - bzero(&hints, sizeof(hints)); + memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET6; hints.ai_socktype = SOCK_DGRAM; /*dummy*/ hints.ai_flags = AI_NUMERICHOST; @@ -940,7 +940,7 @@ parse_prefix(const char *word, size_t wordlen, struct bgpd_addr *addr, if (word == NULL) return (0); - bzero(addr, sizeof(struct bgpd_addr)); + memset(addr, 0, sizeof(struct bgpd_addr)); if ((p = strrchr(word, '/')) != NULL) { size_t plen = strlen(p);