summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-05-18 04:29:35 +0000
committerDamien Miller <djm@mindrot.org>2020-05-27 10:32:30 +1000
commitb6d251ed9af90e16c08a72c4aac2cb8ace8f94b1 (patch)
tree2a71162dbe0834ca4787c7c69d4ca57413df5ab8
parent3ab6fccc3935e9b778ff52f9c8d40f215d58e01d (diff)
upstream: avoid possible NULL deref; from Pedro Martelletto
OpenBSD-Commit-ID: e6099c3fbb70aa67eb106e84d8b43f1fa919b721
-rw-r--r--ssh-keygen.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 8c23a54c..2c5c75db 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.409 2020/05/02 07:19:43 djm Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.409.2.1 2020/05/18 19:02:13 benno Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2950,14 +2950,16 @@ do_download_sk(const char *skprovider, const char *device)
&keys, &nkeys)) != 0) {
if (i == 0 && r == SSH_ERR_KEY_WRONG_PASSPHRASE)
continue;
- freezero(pin, strlen(pin));
+ if (pin != NULL)
+ freezero(pin, strlen(pin));
error("Unable to load resident keys: %s", ssh_err(r));
return -1;
}
}
if (nkeys == 0)
logit("No keys to download");
- freezero(pin, strlen(pin));
+ if (pin != NULL)
+ freezero(pin, strlen(pin));
for (i = 0; i < nkeys; i++) {
if (keys[i]->type != KEY_ECDSA_SK &&