summaryrefslogtreecommitdiffstats
path: root/ssh-add.c
diff options
context:
space:
mode:
authorjsg@openbsd.org <jsg@openbsd.org>2020-02-26 14:40:09 +0100
committerDamien Miller <djm@mindrot.org>2020-02-28 02:26:28 +0100
commitd5ba1c03278eb079438bb038266d80d7477d49cb (patch)
tree6d8dd2d802af796bcb7c9d6d018196a448bb9ff6 /ssh-add.c
parentupstream: Have sftp reject "-1" in the same way as ssh(1) and (diff)
downloadopenssh-d5ba1c03278eb079438bb038266d80d7477d49cb.tar.xz
openssh-d5ba1c03278eb079438bb038266d80d7477d49cb.zip
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 'ssh-add.c')
-rw-r--r--ssh-add.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/ssh-add.c b/ssh-add.c
index 18f4e12dd..c7bb02cb0 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-add.c,v 1.153 2020/02/18 08:58:33 dtucker Exp $ */
+/* $OpenBSD: ssh-add.c,v 1.154 2020/02/26 13:40:09 jsg Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -105,8 +105,7 @@ static void
clear_pass(void)
{
if (pass) {
- explicit_bzero(pass, strlen(pass));
- free(pass);
+ freezero(pass, strlen(pass));
pass = NULL;
}
}
@@ -521,8 +520,7 @@ lock_agent(int agent_fd, int lock)
fprintf(stderr, "Passwords do not match.\n");
passok = 0;
}
- explicit_bzero(p2, strlen(p2));
- free(p2);
+ freezero(p2, strlen(p2));
}
if (passok) {
if ((r = ssh_lock_agent(agent_fd, lock, p1)) == 0) {
@@ -533,8 +531,7 @@ lock_agent(int agent_fd, int lock)
lock ? "" : "un", ssh_err(r));
}
}
- explicit_bzero(p1, strlen(p1));
- free(p1);
+ freezero(p1, strlen(p1));
return (ret);
}