summaryrefslogtreecommitdiff
path: root/sshbuf.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2016-01-14 15:07:15 +0000
committerColin Watson <cjwatson@debian.org>2016-01-14 15:27:10 +0000
commit4810a3bdc4fe716b6ea91518e920785e4af83a26 (patch)
tree37a1d7f0ab88c9b3160d1dc35642c4f050f00662 /sshbuf.c
parent384abfcda5999e864f1de256f90e4479ccbeabd5 (diff)
parent003a875a474100d250b6643270ef3874da6591d8 (diff)
New upstream release (7.1p2).
Diffstat (limited to 'sshbuf.c')
-rw-r--r--sshbuf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sshbuf.c b/sshbuf.c
index dbe0c9192..19e162c07 100644
--- a/sshbuf.c
+++ b/sshbuf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf.c,v 1.3 2015/01/20 23:14:00 deraadt Exp $ */ 1/* $OpenBSD: sshbuf.c,v 1.4 2015/10/05 17:11:21 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -134,7 +134,7 @@ sshbuf_fromb(struct sshbuf *buf)
134void 134void
135sshbuf_init(struct sshbuf *ret) 135sshbuf_init(struct sshbuf *ret)
136{ 136{
137 bzero(ret, sizeof(*ret)); 137 explicit_bzero(ret, sizeof(*ret));
138 ret->alloc = SSHBUF_SIZE_INIT; 138 ret->alloc = SSHBUF_SIZE_INIT;
139 ret->max_size = SSHBUF_SIZE_MAX; 139 ret->max_size = SSHBUF_SIZE_MAX;
140 ret->readonly = 0; 140 ret->readonly = 0;
@@ -177,10 +177,10 @@ sshbuf_free(struct sshbuf *buf)
177 return; 177 return;
178 dont_free = buf->dont_free; 178 dont_free = buf->dont_free;
179 if (!buf->readonly) { 179 if (!buf->readonly) {
180 bzero(buf->d, buf->alloc); 180 explicit_bzero(buf->d, buf->alloc);
181 free(buf->d); 181 free(buf->d);
182 } 182 }
183 bzero(buf, sizeof(*buf)); 183 explicit_bzero(buf, sizeof(*buf));
184 if (!dont_free) 184 if (!dont_free)
185 free(buf); 185 free(buf);
186} 186}
@@ -196,7 +196,7 @@ sshbuf_reset(struct sshbuf *buf)
196 return; 196 return;
197 } 197 }
198 if (sshbuf_check_sanity(buf) == 0) 198 if (sshbuf_check_sanity(buf) == 0)
199 bzero(buf->d, buf->alloc); 199 explicit_bzero(buf->d, buf->alloc);
200 buf->off = buf->size = 0; 200 buf->off = buf->size = 0;
201 if (buf->alloc != SSHBUF_SIZE_INIT) { 201 if (buf->alloc != SSHBUF_SIZE_INIT) {
202 if ((d = realloc(buf->d, SSHBUF_SIZE_INIT)) != NULL) { 202 if ((d = realloc(buf->d, SSHBUF_SIZE_INIT)) != NULL) {
@@ -255,7 +255,7 @@ sshbuf_set_max_size(struct sshbuf *buf, size_t max_size)
255 rlen = roundup(buf->size, SSHBUF_SIZE_INC); 255 rlen = roundup(buf->size, SSHBUF_SIZE_INC);
256 if (rlen > max_size) 256 if (rlen > max_size)
257 rlen = max_size; 257 rlen = max_size;
258 bzero(buf->d + buf->size, buf->alloc - buf->size); 258 explicit_bzero(buf->d + buf->size, buf->alloc - buf->size);
259 SSHBUF_DBG(("new alloc = %zu", rlen)); 259 SSHBUF_DBG(("new alloc = %zu", rlen));
260 if ((dp = realloc(buf->d, rlen)) == NULL) 260 if ((dp = realloc(buf->d, rlen)) == NULL)
261 return SSH_ERR_ALLOC_FAIL; 261 return SSH_ERR_ALLOC_FAIL;