From: eric Date: Thu, 26 Dec 2013 17:25:32 +0000 (+0000) Subject: bcopy -> memmove X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c1392a69d9ca7c71ad266bedfdf6c65840b62216;p=openbsd bcopy -> memmove bzero -> memset --- diff --git a/usr.sbin/smtpd/ber.c b/usr.sbin/smtpd/ber.c index 01da3135e25..58c134c88ee 100644 --- a/usr.sbin/smtpd/ber.c +++ b/usr.sbin/smtpd/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.3 2013/01/26 09:37:23 gilles Exp $ */ +/* $OpenBSD: ber.c,v 1.4 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2007 Reyk Floeter @@ -276,7 +276,7 @@ ber_add_nstring(struct ber_element *prev, const char *string0, size_t len) return NULL; } - bcopy(string0, string, len); + memmove(string, string0, len); elm->be_val = string; elm->be_len = len; elm->be_free = 1; /* free string on cleanup */ @@ -320,7 +320,7 @@ ber_add_bitstring(struct ber_element *prev, const void *v0, size_t len) return NULL; } - bcopy(v0, v, len); + memmove(v, v0, len); elm->be_val = v; elm->be_len = len; elm->be_free = 1; /* free string on cleanup */ @@ -420,7 +420,7 @@ ber_string2oid(const char *oidstr, struct ber_oid *o) if (strlcpy(str, oidstr, sizeof(str)) >= sizeof(str)) return (-1); - bzero(o, sizeof(*o)); + memset(o, 0, sizeof(*o)); /* Parse OID strings in the common forms n.n.n, n_n_n_n, or n-n-n */ for (p = sp = str; p != NULL; sp = p) { @@ -474,7 +474,7 @@ ber_add_noid(struct ber_element *prev, struct ber_oid *o, int n) if (n > BER_MAX_OID_LEN) return (NULL); no.bo_n = n; - bcopy(&o->bo_id, &no.bo_id, sizeof(no.bo_id)); + memmove(&no.bo_id, &o->bo_id, sizeof(no.bo_id)); return (ber_add_oid(prev, &no)); } @@ -505,7 +505,7 @@ ber_get_oid(struct ber_element *elm, struct ber_oid *o) if (!buf[i]) return (-1); - bzero(o, sizeof(*o)); + memset(o, 0, sizeof(*o)); o->bo_id[j++] = buf[i] / 40; o->bo_id[j++] = buf[i++] % 40; for (; i < len && j < BER_MAX_OID_LEN; i++) { @@ -621,7 +621,7 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...) struct ber_oid *o; struct ber_element *parent[_MAX_SEQ], **e; - bzero(parent, sizeof(struct ber_element *) * _MAX_SEQ); + memset(parent, 0, sizeof(struct ber_element *) * _MAX_SEQ); va_start(ap, fmt); while (*fmt) { @@ -958,7 +958,8 @@ static void ber_write(struct ber *ber, void *buf, size_t len) { if (ber->br_wptr + len <= ber->br_wend) - bcopy(buf, ber->br_wptr, len); + memmove(ber->br_wptr, buf, len); + ber->br_wptr += len; } @@ -1169,7 +1170,7 @@ ber_readbuf(struct ber *b, void *buf, size_t nbytes) return (-1); /* end of buffer and parser wants more data */ } - bcopy(b->br_rptr, buf, len); + memmove(buf, b->br_rptr, len); b->br_rptr += len; return (len); diff --git a/usr.sbin/smtpd/config.c b/usr.sbin/smtpd/config.c index f22da008ad9..32e75b81e55 100644 --- a/usr.sbin/smtpd/config.c +++ b/usr.sbin/smtpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.21 2013/11/18 11:47:16 eric Exp $ */ +/* $OpenBSD: config.c,v 1.22 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -68,8 +68,8 @@ purge_config(uint8_t what) } if (what & PURGE_SSL) { while (dict_poproot(env->sc_ssl_dict, (void **)&s)) { - bzero(s->ssl_cert, s->ssl_cert_len); - bzero(s->ssl_key, s->ssl_key_len); + memset(s->ssl_cert, 0, s->ssl_cert_len); + memset(s->ssl_key, 0, s->ssl_key_len); free(s->ssl_cert); free(s->ssl_key); free(s); diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index 5ec9202da3c..8e95836584e 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.93 2013/12/06 14:12:34 eric Exp $ */ +/* $OpenBSD: control.c,v 1.94 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -193,7 +193,7 @@ control_create_socket(void) if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) fatal("control: socket"); - bzero(&sun, sizeof(sun)); + memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_UNIX; if (strlcpy(sun.sun_path, SMTPD_SOCKET, sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) @@ -275,7 +275,7 @@ control(void) tree_init(&ctl_conns); - bzero(&digest, sizeof digest); + memset(&digest, 0, sizeof digest); digest.startup = time(NULL); config_peer(PROC_SCHEDULER); diff --git a/usr.sbin/smtpd/crypto.c b/usr.sbin/smtpd/crypto.c index 209a7538975..2b9f264e2c5 100644 --- a/usr.sbin/smtpd/crypto.c +++ b/usr.sbin/smtpd/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.3 2013/07/22 13:20:49 eric Exp $ */ +/* $OpenBSD: crypto.c,v 1.4 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2013 Gilles Chehade @@ -52,7 +52,7 @@ crypto_setup(const char *key, size_t len) if (len != KEY_SIZE) return 0; - bzero(&cp, sizeof cp); + memset(&cp, 0, sizeof cp); cp.cipher = EVP_aes_256_gcm(); /* openssl rand -hex 16 */ diff --git a/usr.sbin/smtpd/delivery_lmtp.c b/usr.sbin/smtpd/delivery_lmtp.c index be30fa82ce8..b40dbc0e0d0 100644 --- a/usr.sbin/smtpd/delivery_lmtp.c +++ b/usr.sbin/smtpd/delivery_lmtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: delivery_lmtp.c,v 1.3 2013/10/26 12:27:58 eric Exp $ */ +/* $OpenBSD: delivery_lmtp.c,v 1.4 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2013 Ashish SHUKLA @@ -74,7 +74,7 @@ inet_socket (char *address) hostname = address; s = -1; - bzero(&hints, sizeof(hints)); + memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_NUMERICSERV; @@ -108,7 +108,7 @@ unix_socket(char *path) { struct sockaddr_un addr; int s; - bzero(&addr, sizeof(addr)); + memset(&addr, 0, sizeof(addr)); if ((s = socket(PF_LOCAL, SOCK_STREAM, 0)) == -1) { warn("socket"); diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c index 957785d495b..96f04d6b3c3 100644 --- a/usr.sbin/smtpd/dns.c +++ b/usr.sbin/smtpd/dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dns.c,v 1.69 2013/11/18 11:55:41 eric Exp $ */ +/* $OpenBSD: dns.c,v 1.70 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -123,7 +123,7 @@ domainname_is_addr(const char *s, struct sockaddr *sa, socklen_t *sl) return (0); buf[l - 1] = '\0'; - bzero(&hints, sizeof(hints)); + memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_NUMERICHOST; hints.ai_socktype = SOCK_STREAM; if (i6) diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c index b86de109bb6..fd36b8d161c 100644 --- a/usr.sbin/smtpd/enqueue.c +++ b/usr.sbin/smtpd/enqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enqueue.c,v 1.73 2013/12/06 14:26:25 eric Exp $ */ +/* $OpenBSD: enqueue.c,v 1.74 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2005 Henning Brauer @@ -172,7 +172,7 @@ enqueue(int argc, char *argv[]) int save_argc; char **save_argv; - bzero(&msg, sizeof(msg)); + memset(&msg, 0, sizeof(msg)); time(×tamp); save_argc = argc; @@ -484,7 +484,7 @@ parse_message(FILE *fin, int get_from, int tflag, FILE *fout) uint i, cur = HDR_NONE; uint header_seen = 0, header_done = 0; - bzero(&pstate, sizeof(pstate)); + memset(&pstate, 0, sizeof(pstate)); for (;;) { buf = fgetln(fin, &len); if (buf == NULL && ferror(fin)) diff --git a/usr.sbin/smtpd/envelope.c b/usr.sbin/smtpd/envelope.c index ba83c3d9543..eaa2717051b 100644 --- a/usr.sbin/smtpd/envelope.c +++ b/usr.sbin/smtpd/envelope.c @@ -1,4 +1,4 @@ -/* $OpenBSD: envelope.c,v 1.25 2013/12/05 09:44:16 eric Exp $ */ +/* $OpenBSD: envelope.c,v 1.26 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -74,7 +74,7 @@ envelope_buffer_to_dict(struct dict *d, const char *ibuf, size_t buflen) size_t len; char *buf, *field, *nextline; - bzero(lbuf, sizeof lbuf); + memset(lbuf, 0, sizeof lbuf); if (strlcpy(lbuf, ibuf, sizeof lbuf) >= sizeof lbuf) goto err; buf = lbuf; @@ -156,7 +156,7 @@ envelope_load_buffer(struct envelope *ep, const char *ibuf, size_t buflen) goto end; } - bzero(ep, sizeof *ep); + memset(ep, 0, sizeof *ep); ret = envelope_ascii_load(ep, &d); if (ret) ep->version = SMTPD_ENVELOPE_VERSION; @@ -281,8 +281,8 @@ ascii_load_sockaddr(struct sockaddr_storage *ss, char *buf) struct sockaddr_in6 ssin6; struct sockaddr_in ssin; - bzero(&ssin, sizeof ssin); - bzero(&ssin6, sizeof ssin6); + memset(&ssin, 0, sizeof ssin); + memset(&ssin6, 0, sizeof ssin6); if (!strcmp("local", buf)) { ss->ss_family = AF_LOCAL; @@ -797,7 +797,7 @@ envelope_ascii_dump(const struct envelope *ep, char **dest, size_t *len, const c if (*dest == NULL) return; - bzero(buf, sizeof buf); + memset(buf, 0, sizeof buf); if (! ascii_dump_field(field, ep, buf, sizeof buf)) goto err; if (buf[0] == '\0') diff --git a/usr.sbin/smtpd/expand.c b/usr.sbin/smtpd/expand.c index b03f7a254b9..7ecef7f7bf1 100644 --- a/usr.sbin/smtpd/expand.c +++ b/usr.sbin/smtpd/expand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expand.c,v 1.24 2013/10/24 20:39:23 eric Exp $ */ +/* $OpenBSD: expand.c,v 1.25 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2009 Gilles Chehade @@ -195,7 +195,7 @@ expand_line_split(char **line, char **ret) int esc, i, dq, sq; char *s; - bzero(buffer, sizeof buffer); + memset(buffer, 0, sizeof buffer); esc = dq = sq = i = 0; for (s = *line; (*s) && (i < (int)sizeof(buffer)); ++s) { if (esc) { @@ -238,7 +238,7 @@ expand_line(struct expand *expand, const char *s, int do_includes) char *p, *subrcpt; int ret; - bzero(buffer, sizeof buffer); + memset(buffer, 0, sizeof buffer); if (strlcpy(buffer, s, sizeof buffer) >= sizeof buffer) return 0; diff --git a/usr.sbin/smtpd/filter_api.c b/usr.sbin/smtpd/filter_api.c index 1344e4cc9b0..04d869b8adb 100644 --- a/usr.sbin/smtpd/filter_api.c +++ b/usr.sbin/smtpd/filter_api.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filter_api.c,v 1.11 2013/11/06 10:12:07 eric Exp $ */ +/* $OpenBSD: filter_api.c,v 1.12 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -414,7 +414,7 @@ filter_api_init(void) tree_init(&sessions); event_init(); - bzero(&fi, sizeof(fi)); + memset(&fi, 0, sizeof(fi)); fi.p.proc = PROC_MFA; fi.p.name = "filter"; fi.p.handler = filter_dispatch; diff --git a/usr.sbin/smtpd/ioev.c b/usr.sbin/smtpd/ioev.c index 7468c010a47..597a9f37380 100644 --- a/usr.sbin/smtpd/ioev.c +++ b/usr.sbin/smtpd/ioev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioev.c,v 1.14 2013/10/26 12:27:59 eric Exp $ */ +/* $OpenBSD: ioev.c,v 1.15 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -152,7 +152,7 @@ io_set_linger(int fd, int linger) { struct linger l; - bzero(&l, sizeof(l)); + memset(&l, 0, sizeof(l)); l.l_onoff = linger ? 1 : 0; l.l_linger = linger; if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) == -1) diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c index 96565b588e9..cdf65824c76 100644 --- a/usr.sbin/smtpd/lka_session.c +++ b/usr.sbin/smtpd/lka_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka_session.c,v 1.61 2013/11/19 10:22:42 eric Exp $ */ +/* $OpenBSD: lka_session.c,v 1.62 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -113,7 +113,7 @@ lka_session(uint64_t id, struct envelope *envelope) lks->envelope = *envelope; TAILQ_INIT(&lks->nodes); - bzero(&xn, sizeof xn); + memset(&xn, 0, sizeof xn); xn.type = EXPAND_ADDRESS; xn.u.mailaddr = lks->envelope.rcpt; lks->expand.rule = NULL; @@ -344,7 +344,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) lks->expand.rule = rule; lks->expand.parent = xn; lks->expand.alias = 1; - bzero(&node, sizeof node); + memset(&node, 0, sizeof node); node.type = EXPAND_USERNAME; mailaddr_to_username(&xn->u.mailaddr, node.u.user, sizeof node.u.user); @@ -408,7 +408,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) lks->rule = rule; lks->node = xn; - bzero(&fwreq, sizeof(fwreq)); + memset(&fwreq, 0, sizeof(fwreq)); fwreq.id = lks->id; (void)strlcpy(fwreq.user, lk.userinfo.username, sizeof(fwreq.user)); (void)strlcpy(fwreq.directory, lk.userinfo.directory, sizeof(fwreq.directory)); @@ -549,7 +549,7 @@ lka_submit(struct lka_session *lks, struct rule *rule, struct expandnode *xn) strlcpy(ep->agent.mda.buffer, rule->r_value.buffer, sizeof ep->agent.mda.buffer); - bzero(tag, sizeof tag); + memset(tag, 0, sizeof tag); if (! mailaddr_tag(&ep->dest, tag, sizeof tag)) { lks->error = LKA_PERMFAIL; free(ep); @@ -766,7 +766,7 @@ lka_expand_format(char *buf, size_t len, const struct envelope *ep, if (len < sizeof tmpbuf) fatalx("lka_expand_format: tmp buffer < rule buffer"); - bzero(tmpbuf, sizeof tmpbuf); + memset(tmpbuf, 0, sizeof tmpbuf); pbuf = buf; ptmp = tmpbuf; ret = tmpret = 0; diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c index ccfbbb20a2c..ad456565afb 100644 --- a/usr.sbin/smtpd/makemap.c +++ b/usr.sbin/smtpd/makemap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makemap.c,v 1.47 2013/11/28 10:43:37 eric Exp $ */ +/* $OpenBSD: makemap.c,v 1.48 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -77,7 +77,7 @@ enum output_type { void purge_config(uint8_t what) { - bzero(env, sizeof(struct smtpd)); + memset(env, 0, sizeof(struct smtpd)); } int diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c index 652f7597faa..7aaae726f0d 100644 --- a/usr.sbin/smtpd/mda.c +++ b/usr.sbin/smtpd/mda.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mda.c,v 1.99 2013/11/28 10:43:37 eric Exp $ */ +/* $OpenBSD: mda.c,v 1.100 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -253,7 +253,7 @@ mda_imsg(struct mproc *p, struct imsg *imsg) /* request parent to fork a helper process */ userinfo = &s->user->userinfo; - bzero(&deliver, sizeof deliver); + memset(&deliver, 0, sizeof deliver); switch (e->method) { case A_MDA: deliver.mode = A_MDA; @@ -628,7 +628,7 @@ mda_getlastline(int fd, char *dst, size_t dstsz) char *ln, buf[SMTPD_MAXLINESIZE]; size_t len; - bzero(buf, sizeof buf); + memset(buf, 0, sizeof buf); if (lseek(fd, 0, SEEK_SET) < 0) { log_warn("warn: mda: lseek"); close(fd); diff --git a/usr.sbin/smtpd/mproc.c b/usr.sbin/smtpd/mproc.c index 94ab79e74fe..4be3d61c1a2 100644 --- a/usr.sbin/smtpd/mproc.c +++ b/usr.sbin/smtpd/mproc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mproc.c,v 1.6 2013/11/21 08:35:54 eric Exp $ */ +/* $OpenBSD: mproc.c,v 1.7 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot @@ -222,8 +222,8 @@ msgbuf_write2(struct msgbuf *msgbuf) char buf[CMSG_SPACE(sizeof(int))]; } cmsgbuf; - bzero(&iov, sizeof(iov)); - bzero(&msg, sizeof(msg)); + memset(&iov, 0, sizeof(iov)); + memset(&msg, 0, sizeof(msg)); TAILQ_FOREACH(buf, &msgbuf->bufs, entry) { if (i >= IOV_MAX) break; diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index d8f47a0ab18..f7f364e0309 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta.c,v 1.177 2013/12/06 14:12:34 eric Exp $ */ +/* $OpenBSD: mta.c,v 1.178 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -1588,7 +1588,7 @@ mta_relay(struct envelope *e) { struct mta_relay key, *r; - bzero(&key, sizeof key); + memset(&key, 0, sizeof key); if (e->agent.mta.relay.flags & RELAY_BACKUP) { key.domain = mta_domain(e->dest.domain, 0); diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c index bcc5606d758..f28c7de0b13 100644 --- a/usr.sbin/smtpd/mta_session.c +++ b/usr.sbin/smtpd/mta_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta_session.c,v 1.49 2013/12/03 09:06:26 eric Exp $ */ +/* $OpenBSD: mta_session.c,v 1.50 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -348,8 +348,8 @@ mta_session_imsg(struct mproc *p, struct imsg *imsg) fatal("mta: ssl_mta_init"); io_start_tls(&s->io, ssl); - bzero(resp_ca_cert->cert, resp_ca_cert->cert_len); - bzero(resp_ca_cert->key, resp_ca_cert->key_len); + memset(resp_ca_cert->cert, 0, resp_ca_cert->cert_len); + memset(resp_ca_cert->key, 0, resp_ca_cert->key_len); free(resp_ca_cert->cert); free(resp_ca_cert->key); free(resp_ca_cert); @@ -676,23 +676,23 @@ mta_enter_state(struct mta_session *s, int newstate) break; case MTA_AUTH_LOGIN_USER: - bzero(ibuf, sizeof ibuf); + memset(ibuf, 0, sizeof ibuf); if (__b64_pton(s->relay->secret, (unsigned char *)ibuf, sizeof(ibuf)-1) == -1) { log_debug("debug: mta: %p: credentials too large on session", s); mta_error(s, "Credentials too large"); break; } - bzero(obuf, sizeof obuf); + memset(obuf, 0, sizeof obuf); __b64_ntop((unsigned char *)ibuf + 1, strlen(ibuf + 1), obuf, sizeof obuf); mta_send(s, "%s", obuf); - bzero(ibuf, sizeof ibuf); - bzero(obuf, sizeof obuf); + memset(ibuf, 0, sizeof ibuf); + memset(obuf, 0, sizeof obuf); break; case MTA_AUTH_LOGIN_PASS: - bzero(ibuf, sizeof ibuf); + memset(ibuf, 0, sizeof ibuf); if (__b64_pton(s->relay->secret, (unsigned char *)ibuf, sizeof(ibuf)-1) == -1) { log_debug("debug: mta: %p: credentials too large on session", s); mta_error(s, "Credentials too large"); @@ -700,12 +700,12 @@ mta_enter_state(struct mta_session *s, int newstate) } offset = strlen(ibuf+1)+2; - bzero(obuf, sizeof obuf); + memset(obuf, 0, sizeof obuf); __b64_ntop((unsigned char *)ibuf + offset, strlen(ibuf + offset), obuf, sizeof obuf); mta_send(s, "%s", obuf); - bzero(ibuf, sizeof ibuf); - bzero(obuf, sizeof obuf); + memset(ibuf, 0, sizeof ibuf); + memset(obuf, 0, sizeof obuf); break; case MTA_READY: @@ -1537,7 +1537,7 @@ mta_verify_certificate(struct mta_session *s) s->flags |= MTA_WAIT; /* Send the client certificate */ - bzero(&req_ca_vrfy, sizeof req_ca_vrfy); + memset(&req_ca_vrfy, 0, sizeof req_ca_vrfy); if (s->relay->cert) pkiname = s->relay->cert; else @@ -1562,7 +1562,7 @@ mta_verify_certificate(struct mta_session *s) if (xchain) { /* Send the chain, one cert at a time */ for (i = 0; i < sk_X509_num(xchain); ++i) { - bzero(&req_ca_vrfy, sizeof req_ca_vrfy); + memset(&req_ca_vrfy, 0, sizeof req_ca_vrfy); req_ca_vrfy.reqid = s->id; x = sk_X509_value(xchain, i); req_ca_vrfy.cert_len = i2d_X509(x, &req_ca_vrfy.cert); @@ -1577,7 +1577,7 @@ mta_verify_certificate(struct mta_session *s) } /* Tell lookup process that it can start verifying, we're done */ - bzero(&req_ca_vrfy, sizeof req_ca_vrfy); + memset(&req_ca_vrfy, 0, sizeof req_ca_vrfy); req_ca_vrfy.reqid = s->id; m_compose(p_lka, IMSG_LKA_SSL_VERIFY, 0, 0, -1, &req_ca_vrfy, sizeof req_ca_vrfy); diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index 42b2b23beaf..d324964d25b 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.134 2013/12/05 15:04:09 eric Exp $ */ +/* $OpenBSD: parse.y,v 1.135 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -529,7 +529,7 @@ relay_via : opt_relay_common relay_via ; main : BOUNCEWARN { - bzero(conf->sc_bounce_warn, sizeof conf->sc_bounce_warn); + memset(conf->sc_bounce_warn, 0, sizeof conf->sc_bounce_warn); } bouncedelays | QUEUE COMPRESSION { conf->sc_queue_flags |= QUEUE_COMPRESSION; @@ -543,7 +543,7 @@ main : BOUNCEWARN { YYERROR; } conf->sc_queue_key = strdup(password); - bzero(password, strlen(password)); + memset(password, 0, strlen(password)); if (conf->sc_queue_key == NULL) { yyerror("memory exhausted"); YYERROR; @@ -607,8 +607,8 @@ main : BOUNCEWARN { } limits_mta | LIMIT SCHEDULER limits_scheduler | LISTEN { - bzero(&l, sizeof l); - bzero(&listen_opts, sizeof listen_opts); + memset(&l, 0, sizeof l); + memset(&listen_opts, 0, sizeof listen_opts); listen_opts.family = AF_UNSPEC; } ON STRING listen { listen_opts.ifx = $4; @@ -1517,7 +1517,7 @@ parse_config(struct smtpd *x_conf, const char *filename, int opts) return (-1); conf = x_conf; - bzero(conf, sizeof(*conf)); + memset(conf, 0, sizeof(*conf)); strlcpy(conf->sc_hostname, hostname, sizeof(conf->sc_hostname)); @@ -1809,7 +1809,7 @@ host_v4(const char *s, in_port_t port) struct sockaddr_in *sain; struct listener *h; - bzero(&ina, sizeof(ina)); + memset(&ina, 0, sizeof(ina)); if (inet_pton(AF_INET, s, &ina) != 1) return (NULL); @@ -1830,7 +1830,7 @@ host_v6(const char *s, in_port_t port) struct sockaddr_in6 *sin6; struct listener *h; - bzero(&ina6, sizeof(ina6)); + memset(&ina6, 0, sizeof(ina6)); if (inet_pton(AF_INET6, s, &ina6) != 1) return (NULL); @@ -1853,7 +1853,7 @@ host_dns(struct listenerlist *al, struct listen_opts *lo) struct sockaddr_in6 *sin6; struct listener *h; - bzero(&hints, sizeof(hints)); + memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; /* DUMMY */ error = getaddrinfo(lo->ifx, NULL, &hints, &res0); diff --git a/usr.sbin/smtpd/queue_fs.c b/usr.sbin/smtpd/queue_fs.c index d00b1208d3b..02d8a987c01 100644 --- a/usr.sbin/smtpd/queue_fs.c +++ b/usr.sbin/smtpd/queue_fs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_fs.c,v 1.3 2013/11/06 10:07:29 eric Exp $ */ +/* $OpenBSD: queue_fs.c,v 1.4 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -354,7 +354,7 @@ queue_fs_envelope_walk(uint64_t *evpid, char *buf, size_t len) hdl = fsqueue_qwalk_new(); if (fsqueue_qwalk(hdl, evpid)) { - bzero(buf, len); + memset(buf, 0, len); r = queue_fs_envelope_load(*evpid, buf, len); if (r) { msgid = evpid_to_msgid(*evpid); diff --git a/usr.sbin/smtpd/scheduler.c b/usr.sbin/smtpd/scheduler.c index 1a5a5a6740d..98343bf0144 100644 --- a/usr.sbin/smtpd/scheduler.c +++ b/usr.sbin/smtpd/scheduler.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scheduler.c,v 1.39 2013/12/05 09:26:47 eric Exp $ */ +/* $OpenBSD: scheduler.c,v 1.40 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -477,7 +477,7 @@ scheduler_timeout(int fd, short event, void *p) !(env->sc_flags & SMTPD_MTA_PAUSED)) typemask |= SCHED_MTA; - bzero(&batch, sizeof (batch)); + memset(&batch, 0, sizeof (batch)); batch.evpids = evpids; batch.evpcount = env->sc_scheduler_max_schedule; backend->batch(typemask, &batch); diff --git a/usr.sbin/smtpd/scheduler_ramqueue.c b/usr.sbin/smtpd/scheduler_ramqueue.c index 7703c0fea66..2d629d95883 100644 --- a/usr.sbin/smtpd/scheduler_ramqueue.c +++ b/usr.sbin/smtpd/scheduler_ramqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scheduler_ramqueue.c,v 1.35 2013/12/05 09:26:47 eric Exp $ */ +/* $OpenBSD: scheduler_ramqueue.c,v 1.36 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -741,7 +741,7 @@ sorted_insert(struct rq_queue *rq, struct rq_envelope *evp) static void rq_queue_init(struct rq_queue *rq) { - bzero(rq, sizeof *rq); + memset(rq, 0, sizeof *rq); tree_init(&rq->messages); TAILQ_INIT(&rq->q_pending); TAILQ_INIT(&rq->q_inflight); diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 127af76f2ff..d4866a34e9c 100644 --- a/usr.sbin/smtpd/smtp_session.c +++ b/usr.sbin/smtpd/smtp_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_session.c,v 1.191 2013/11/28 12:39:23 eric Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.192 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -585,8 +585,8 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) io_set_read(&s->io); io_start_tls(&s->io, ssl); - bzero(resp_ca_cert->cert, resp_ca_cert->cert_len); - bzero(resp_ca_cert->key, resp_ca_cert->key_len); + memset(resp_ca_cert->cert, 0, resp_ca_cert->cert_len); + memset(resp_ca_cert->key, 0, resp_ca_cert->key_len); free(resp_ca_cert->cert); free(resp_ca_cert->key); free(resp_ca_cert); @@ -1275,7 +1275,7 @@ smtp_rfc4954_auth_login(struct smtp_session *s, char *arg) return; case STATE_AUTH_USERNAME: - bzero(s->username, sizeof(s->username)); + memset(s->username, 0, sizeof(s->username)); if (__b64_pton(arg, (unsigned char *)s->username, sizeof(s->username) - 1) == -1) goto abort; @@ -1285,7 +1285,7 @@ smtp_rfc4954_auth_login(struct smtp_session *s, char *arg) return; case STATE_AUTH_PASSWORD: - bzero(buf, sizeof(buf)); + memset(buf, 0, sizeof(buf)); if (__b64_pton(arg, (unsigned char *)buf, sizeof(buf)-1) == -1) goto abort; @@ -1467,7 +1467,7 @@ smtp_message_reset(struct smtp_session *s, int prepare) free(rcpt); } - bzero(&s->evp, sizeof s->evp); + memset(&s->evp, 0, sizeof s->evp); s->msgflags = 0; s->destcount = 0; s->rcptcount = 0; @@ -1652,7 +1652,7 @@ smtp_verify_certificate(struct smtp_session *s) tree_xset(&wait_ssl_verify, s->id, s); /* Send the client certificate */ - bzero(&req_ca_vrfy, sizeof req_ca_vrfy); + memset(&req_ca_vrfy, 0, sizeof req_ca_vrfy); if (strlcpy(req_ca_vrfy.pkiname, s->listener->ssl_cert_name, sizeof req_ca_vrfy.pkiname) >= sizeof req_ca_vrfy.pkiname) return 0; @@ -1673,7 +1673,7 @@ smtp_verify_certificate(struct smtp_session *s) if (xchain) { /* Send the chain, one cert at a time */ for (i = 0; i < sk_X509_num(xchain); ++i) { - bzero(&req_ca_vrfy, sizeof req_ca_vrfy); + memset(&req_ca_vrfy, 0, sizeof req_ca_vrfy); req_ca_vrfy.reqid = s->id; x = sk_X509_value(xchain, i); req_ca_vrfy.cert_len = i2d_X509(x, &req_ca_vrfy.cert); @@ -1688,7 +1688,7 @@ smtp_verify_certificate(struct smtp_session *s) } /* Tell lookup process that it can start verifying, we're done */ - bzero(&req_ca_vrfy, sizeof req_ca_vrfy); + memset(&req_ca_vrfy, 0, sizeof req_ca_vrfy); req_ca_vrfy.reqid = s->id; m_compose(p_lka, IMSG_LKA_SSL_VERIFY, 0, 0, -1, &req_ca_vrfy, sizeof req_ca_vrfy); diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index 6e72e30c60a..9de9db61864 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.113 2013/11/13 09:15:41 eric Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.114 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -109,7 +109,7 @@ srv_connect(void) if ((ctl_sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) err(1, "socket"); - bzero(&sun, sizeof(sun)); + memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_UNIX; strlcpy(sun.sun_path, SMTPD_SOCKET, sizeof(sun.sun_path)); if (connect(ctl_sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) { @@ -411,7 +411,7 @@ do_monitor(int argc, struct parameter *argv) struct stat_digest last, digest; size_t count; - bzero(&last, sizeof(last)); + memset(&last, 0, sizeof(last)); count = 0; while (1) { @@ -709,7 +709,7 @@ do_show_stats(int argc, struct parameter *argv) struct stat_kv kv; time_t duration; - bzero(&kv, sizeof kv); + memset(&kv, 0, sizeof kv); while (1) { srv_send(IMSG_STATS_GET, &kv, sizeof kv); diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c index 6520e519a6e..fb14c68885f 100644 --- a/usr.sbin/smtpd/smtpd.c +++ b/usr.sbin/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.207 2013/11/28 12:50:40 eric Exp $ */ +/* $OpenBSD: smtpd.c,v 1.208 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -793,7 +793,7 @@ main(int argc, char *argv[]) config_done(); evtimer_set(&config_ev, parent_send_config, NULL); - bzero(&tv, sizeof(tv)); + memset(&tv, 0, sizeof(tv)); evtimer_add(&config_ev, &tv); /* defer offline scanning for a second */ @@ -1151,7 +1151,7 @@ offline_enqueue(char *name) size_t len; arglist args; - bzero(&args, sizeof(args)); + memset(&args, 0, sizeof(args)); if (lstat(path, &sb) == -1) { log_warn("warn: smtpd: lstat: %s", path); diff --git a/usr.sbin/smtpd/ssl.c b/usr.sbin/smtpd/ssl.c index b6c064711f2..65e65cd9950 100644 --- a/usr.sbin/smtpd/ssl.c +++ b/usr.sbin/smtpd/ssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl.c,v 1.57 2013/11/28 12:50:40 eric Exp $ */ +/* $OpenBSD: ssl.c,v 1.58 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -152,7 +152,7 @@ ssl_password_cb(char *buf, int size, int rwflag, void *u) { size_t len; if (u == NULL) { - bzero(buf, size); + memset(buf, 0, size); return (0); } if ((len = strlcpy(buf, u, size)) >= (size_t)size) @@ -177,7 +177,7 @@ ssl_getpass_cb(char *buf, int size, int rwflag, void *u) ret = len; end: if (len) - bzero(pass, len); + memset(pass, 0, len); return ret; } diff --git a/usr.sbin/smtpd/table.c b/usr.sbin/smtpd/table.c index 0291d83ef1a..4b29055d40f 100644 --- a/usr.sbin/smtpd/table.c +++ b/usr.sbin/smtpd/table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table.c,v 1.12 2013/11/28 10:57:29 eric Exp $ */ +/* $OpenBSD: table.c,v 1.13 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -449,7 +449,7 @@ table_inet6_match(struct sockaddr_in6 *ss, struct netaddr *ssmask) struct in6_addr mask; int i; - bzero(&mask, sizeof(mask)); + memset(&mask, 0, sizeof(mask)); for (i = 0; i < ssmask->bits / 8; i++) mask.s6_addr[i] = 0xff; i = ssmask->bits % 8; diff --git a/usr.sbin/smtpd/table_ldap.c b/usr.sbin/smtpd/table_ldap.c index 8a3b9ef6f56..7ff91e6aca6 100644 --- a/usr.sbin/smtpd/table_ldap.c +++ b/usr.sbin/smtpd/table_ldap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_ldap.c,v 1.7 2013/11/28 10:43:37 eric Exp $ */ +/* $OpenBSD: table_ldap.c,v 1.8 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -186,7 +186,7 @@ ldap_connect(const char *addr) return (NULL); } - bzero(&hints, sizeof(hints)); + memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; /* DUMMY */ error = getaddrinfo(lu.host, NULL, &hints, &res0); @@ -506,7 +506,7 @@ ldap_run_query(int type, const char *key, char *dst, size_t sz) return (-1); } - bzero(res, sizeof(res)); + memset(res, 0, sizeof(res)); ret = ldap_query(filter, q->attrs, res, q->attrn); if (ret <= 0 || dst == NULL) goto end; diff --git a/usr.sbin/smtpd/table_sqlite.c b/usr.sbin/smtpd/table_sqlite.c index 00d2c03a6da..498ac26a5cc 100644 --- a/usr.sbin/smtpd/table_sqlite.c +++ b/usr.sbin/smtpd/table_sqlite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_sqlite.c,v 1.10 2013/11/28 10:43:37 eric Exp $ */ +/* $OpenBSD: table_sqlite.c,v 1.11 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -175,8 +175,8 @@ table_sqlite_update(void) dbpath = NULL; _db = NULL; - bzero(queries, sizeof(queries)); - bzero(_statements, sizeof(_statements)); + memset(queries, 0, sizeof(queries)); + memset(_statements, 0, sizeof(_statements)); _query_fetch_source = NULL; _stmt_fetch_source = NULL; diff --git a/usr.sbin/smtpd/to.c b/usr.sbin/smtpd/to.c index d4a5809e19c..4362678fc74 100644 --- a/usr.sbin/smtpd/to.c +++ b/usr.sbin/smtpd/to.c @@ -1,4 +1,4 @@ -/* $OpenBSD: to.c,v 1.13 2013/11/28 10:43:37 eric Exp $ */ +/* $OpenBSD: to.c,v 1.14 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2009 Jacek Masiulaniec @@ -75,7 +75,7 @@ in6addr_to_text(const struct in6_addr *addr) struct sockaddr_in6 sa_in6; uint16_t tmp16; - bzero(&sa_in6, sizeof(sa_in6)); + memset(&sa_in6, 0, sizeof(sa_in6)); sa_in6.sin6_len = sizeof(sa_in6); sa_in6.sin6_family = AF_INET6; memcpy(&sa_in6.sin6_addr, addr, sizeof(sa_in6.sin6_addr)); @@ -102,7 +102,7 @@ text_to_mailaddr(struct mailaddr *maddr, const char *email) if (strlcpy(buffer, email, sizeof buffer) >= sizeof buffer) return 0; - bzero(maddr, sizeof *maddr); + memset(maddr, 0, sizeof *maddr); username = buffer; hostname = strrchr(username, '@'); @@ -267,8 +267,8 @@ text_to_netaddr(struct netaddr *netaddr, const char *s) struct sockaddr_in6 ssin6; int bits; - bzero(&ssin, sizeof(struct sockaddr_in)); - bzero(&ssin6, sizeof(struct sockaddr_in6)); + memset(&ssin, 0, sizeof(struct sockaddr_in)); + memset(&ssin6, 0, sizeof(struct sockaddr_in6)); if (strncasecmp("IPv6:", s, 5) == 0) s += 5; @@ -345,7 +345,7 @@ text_to_relayhost(struct relayhost *relay, const char *s) size_t i; int len; - bzero(buffer, sizeof buffer); + memset(buffer, 0, sizeof buffer); if (strlcpy(buffer, s, sizeof buffer) >= sizeof buffer) return 0; @@ -415,7 +415,7 @@ relayhost_to_text(const struct relayhost *relay) static char buf[4096]; char port[4096]; - bzero(buf, sizeof buf); + memset(buf, 0, sizeof buf); switch (relay->flags) { case F_SMTPS|F_STARTTLS|F_AUTH: strlcat(buf, "secure+auth://", sizeof buf); @@ -508,7 +508,7 @@ rule_to_text(struct rule *r) { static char buf[4096]; - bzero(buf, sizeof buf); + memset(buf, 0, sizeof buf); strlcpy(buf, r->r_decision == R_ACCEPT ? "accept" : "reject", sizeof buf); if (r->r_tag[0]) { strlcat(buf, " tagged ", sizeof buf); @@ -595,7 +595,7 @@ text_to_userinfo(struct userinfo *userinfo, const char *s) char *p; const char *errstr; - bzero(buf, sizeof buf); + memset(buf, 0, sizeof buf); p = buf; while (*s && *s != ':') *p++ = *s++; @@ -606,7 +606,7 @@ text_to_userinfo(struct userinfo *userinfo, const char *s) sizeof userinfo->username) >= sizeof userinfo->username) goto error; - bzero(buf, sizeof buf); + memset(buf, 0, sizeof buf); p = buf; while (*s && *s != ':') *p++ = *s++; @@ -616,7 +616,7 @@ text_to_userinfo(struct userinfo *userinfo, const char *s) if (errstr) goto error; - bzero(buf, sizeof buf); + memset(buf, 0, sizeof buf); p = buf; while (*s && *s != ':') *p++ = *s++; @@ -654,7 +654,7 @@ text_to_credentials(struct credentials *creds, const char *s) offset = p - s; - bzero(buffer, sizeof buffer); + memset(buffer, 0, sizeof buffer); if (strlcpy(buffer, s, sizeof buffer) >= sizeof buffer) return 0; p = buffer + offset; @@ -737,7 +737,7 @@ alias_is_filter(struct expandnode *alias, const char *line, size_t len) static int alias_is_username(struct expandnode *alias, const char *line, size_t len) { - bzero(alias, sizeof *alias); + memset(alias, 0, sizeof *alias); if (strlcpy(alias->u.user, line, sizeof(alias->u.user)) >= sizeof(alias->u.user)) @@ -759,7 +759,7 @@ alias_is_address(struct expandnode *alias, const char *line, size_t len) { char *domain; - bzero(alias, sizeof *alias); + memset(alias, 0, sizeof *alias); if (len < 3) /* x@y */ return 0; @@ -801,7 +801,7 @@ alias_is_address(struct expandnode *alias, const char *line, size_t len) static int alias_is_filename(struct expandnode *alias, const char *line, size_t len) { - bzero(alias, sizeof *alias); + memset(alias, 0, sizeof *alias); if (*line != '/') return 0; @@ -818,7 +818,7 @@ alias_is_include(struct expandnode *alias, const char *line, size_t len) { size_t skip; - bzero(alias, sizeof *alias); + memset(alias, 0, sizeof *alias); if (strncasecmp(":include:", line, 9) == 0) skip = 9; @@ -839,7 +839,7 @@ alias_is_error(struct expandnode *alias, const char *line, size_t len) { size_t skip; - bzero(alias, sizeof *alias); + memset(alias, 0, sizeof *alias); if (strncasecmp(":error:", line, 7) == 0) skip = 7; diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 34fa5ba002a..d437e58dc25 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.103 2013/11/28 10:43:37 eric Exp $ */ +/* $OpenBSD: util.c,v 1.104 2013/12/26 17:25:32 eric Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -198,7 +198,7 @@ mkdirs(char *path, mode_t mode) if (strlen(path) >= sizeof buf) return 0; - bzero(buf, sizeof buf); + memset(buf, 0, sizeof buf); for (p = path; *p; p++) { if (*p == '/') { if (buf[0] != '\0') @@ -693,7 +693,7 @@ session_socket_no_linger(int fd) { struct linger lng; - bzero(&lng, sizeof(lng)); + memset(&lng, 0, sizeof(lng)); if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1) fatal("session_socket_no_linger"); }