diff options
author | 2016-01-12 23:42:54 +0000 | |
---|---|---|
committer | 2016-01-12 23:42:54 +0000 | |
commit | 5c47a7393414d13d14bc02904528fb40361bbc7d (patch) | |
tree | 3edb96b917fa50317d2f03de7ed732ab26fddc39 /usr.bin/ssh/sshbuf.c | |
parent | Move prototypes of local functions from lp.h to the .c files and make (diff) | |
download | wireguard-openbsd-5c47a7393414d13d14bc02904528fb40361bbc7d.tar.xz wireguard-openbsd-5c47a7393414d13d14bc02904528fb40361bbc7d.zip |
use explicit_bzero() more liberally in the buffer code; ok deraadt
Diffstat (limited to 'usr.bin/ssh/sshbuf.c')
-rw-r--r-- | usr.bin/ssh/sshbuf.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/ssh/sshbuf.c b/usr.bin/ssh/sshbuf.c index 3c49d7f127e..5b122ebc111 100644 --- a/usr.bin/ssh/sshbuf.c +++ b/usr.bin/ssh/sshbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshbuf.c,v 1.5 2015/12/11 04:21:12 mmcc Exp $ */ +/* $OpenBSD: sshbuf.c,v 1.6 2016/01/12 23:42:54 djm Exp $ */ /* * Copyright (c) 2011 Damien Miller * @@ -132,7 +132,7 @@ sshbuf_fromb(struct sshbuf *buf) void sshbuf_init(struct sshbuf *ret) { - bzero(ret, sizeof(*ret)); + explicit_bzero(ret, sizeof(*ret)); ret->alloc = SSHBUF_SIZE_INIT; ret->max_size = SSHBUF_SIZE_MAX; ret->readonly = 0; @@ -176,7 +176,7 @@ sshbuf_free(struct sshbuf *buf) explicit_bzero(buf->d, buf->alloc); free(buf->d); } - bzero(buf, sizeof(*buf)); + explicit_bzero(buf, sizeof(*buf)); if (!dont_free) free(buf); } @@ -192,7 +192,7 @@ sshbuf_reset(struct sshbuf *buf) return; } if (sshbuf_check_sanity(buf) == 0) - bzero(buf->d, buf->alloc); + explicit_bzero(buf->d, buf->alloc); buf->off = buf->size = 0; if (buf->alloc != SSHBUF_SIZE_INIT) { if ((d = realloc(buf->d, SSHBUF_SIZE_INIT)) != NULL) { @@ -251,7 +251,7 @@ sshbuf_set_max_size(struct sshbuf *buf, size_t max_size) rlen = roundup(buf->size, SSHBUF_SIZE_INC); if (rlen > max_size) rlen = max_size; - bzero(buf->d + buf->size, buf->alloc - buf->size); + explicit_bzero(buf->d + buf->size, buf->alloc - buf->size); SSHBUF_DBG(("new alloc = %zu", rlen)); if ((dp = realloc(buf->d, rlen)) == NULL) return SSH_ERR_ALLOC_FAIL; |