summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/sshbuf-misc.c
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2020-02-26 13:40:09 +0000
committerjsg <jsg@openbsd.org>2020-02-26 13:40:09 +0000
commitc9831b39c7f05cf54db0775dea423b6be448db6e (patch)
treef50d8c53bee8b027f393d63b6867f7cdcf2c7a4b /usr.bin/ssh/sshbuf-misc.c
parentHave sftp reject "-1" in the same way as ssh(1) and scp(1) do instead (diff)
downloadwireguard-openbsd-c9831b39c7f05cf54db0775dea423b6be448db6e.tar.xz
wireguard-openbsd-c9831b39c7f05cf54db0775dea423b6be448db6e.zip
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@
Diffstat (limited to 'usr.bin/ssh/sshbuf-misc.c')
-rw-r--r--usr.bin/ssh/sshbuf-misc.c11
1 files changed, 4 insertions, 7 deletions
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;
}