summaryrefslogtreecommitdiff
path: root/sshbuf-misc.c
diff options
context:
space:
mode:
authorjsg@openbsd.org <jsg@openbsd.org>2020-02-26 13:40:09 +0000
committerDamien Miller <djm@mindrot.org>2020-02-28 12:26:28 +1100
commitd5ba1c03278eb079438bb038266d80d7477d49cb (patch)
tree6d8dd2d802af796bcb7c9d6d018196a448bb9ff6 /sshbuf-misc.c
parent9e3220b585c5be19a7431ea4ff8884c137b3a81c (diff)
upstream: change explicit_bzero();free() to freezero()
While freezero() returns early if the pointer is NULL the tests for NULL in callers are left to avoid warnings about passing an uninitialised size argument across a function boundry. ok deraadt@ djm@ OpenBSD-Commit-ID: 2660fa334fcc7cd05ec74dd99cb036f9ade6384a
Diffstat (limited to 'sshbuf-misc.c')
-rw-r--r--sshbuf-misc.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sshbuf-misc.c b/sshbuf-misc.c
index c0336e867..9b5aa208c 100644
--- a/sshbuf-misc.c
+++ b/sshbuf-misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshbuf-misc.c,v 1.13 2020/01/25 23:28:06 djm Exp $ */ 1/* $OpenBSD: sshbuf-misc.c,v 1.14 2020/02/26 13:40:09 jsg Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -156,17 +156,14 @@ sshbuf_b64tod(struct sshbuf *buf, const char *b64)
156 if ((p = malloc(plen)) == NULL) 156 if ((p = malloc(plen)) == NULL)
157 return SSH_ERR_ALLOC_FAIL; 157 return SSH_ERR_ALLOC_FAIL;
158 if ((nlen = b64_pton(b64, p, plen)) < 0) { 158 if ((nlen = b64_pton(b64, p, plen)) < 0) {
159 explicit_bzero(p, plen); 159 freezero(p, plen);
160 free(p);
161 return SSH_ERR_INVALID_FORMAT; 160 return SSH_ERR_INVALID_FORMAT;
162 } 161 }
163 if ((r = sshbuf_put(buf, p, nlen)) < 0) { 162 if ((r = sshbuf_put(buf, p, nlen)) < 0) {
164 explicit_bzero(p, plen); 163 freezero(p, plen);
165 free(p);
166 return r; 164 return r;
167 } 165 }
168 explicit_bzero(p, plen); 166 freezero(p, plen);
169 free(p);
170 return 0; 167 return 0;
171} 168}
172 169