From c9831b39c7f05cf54db0775dea423b6be448db6e Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 26 Feb 2020 13:40:09 +0000 Subject: 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@ --- usr.bin/ssh/sshbuf-misc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'usr.bin/ssh/sshbuf-misc.c') diff --git a/usr.bin/ssh/sshbuf-misc.c b/usr.bin/ssh/sshbuf-misc.c index af02fe69e3f..9ece8bc64a8 100644 --- a/usr.bin/ssh/sshbuf-misc.c +++ b/usr.bin/ssh/sshbuf-misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshbuf-misc.c,v 1.13 2020/01/25 23:28:06 djm Exp $ */ +/* $OpenBSD: sshbuf-misc.c,v 1.14 2020/02/26 13:40:09 jsg Exp $ */ /* * Copyright (c) 2011 Damien Miller * @@ -152,17 +152,14 @@ sshbuf_b64tod(struct sshbuf *buf, const char *b64) if ((p = malloc(plen)) == NULL) return SSH_ERR_ALLOC_FAIL; if ((nlen = b64_pton(b64, p, plen)) < 0) { - explicit_bzero(p, plen); - free(p); + freezero(p, plen); return SSH_ERR_INVALID_FORMAT; } if ((r = sshbuf_put(buf, p, nlen)) < 0) { - explicit_bzero(p, plen); - free(p); + freezero(p, plen); return r; } - explicit_bzero(p, plen); - free(p); + freezero(p, plen); return 0; } -- cgit v1.2.3-59-g8ed1b