summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2022-01-06 22:02:53 +0000
committerDamien Miller <djm@cvs.openbsd.org>2022-01-06 22:02:53 +0000
commit5c505622cd11aeec9968060d38784d76f340a84e (patch)
tree30d5a27b2c6a0f8d39874475b502d613615468fb
parentb8839195fb667728713fcb63ded8599640c9f7f2 (diff)
piece of UpdateHostkeys client strictification: when updating known_hosts
with new keys, ignore NULL keys (forgot to include in prior commit)
-rw-r--r--usr.bin/ssh/hostfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/ssh/hostfile.c b/usr.bin/ssh/hostfile.c
index 7736a980caf..e193d421734 100644
--- a/usr.bin/ssh/hostfile.c
+++ b/usr.bin/ssh/hostfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostfile.c,v 1.92 2021/10/02 03:17:01 dtucker Exp $ */
+/* $OpenBSD: hostfile.c,v 1.93 2022/01/06 22:02:52 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -635,7 +635,7 @@ hostfile_replace_entries(const char *filename, const char *host, const char *ip,
/* Re-add the requested keys */
want = HKF_MATCH_HOST | (ip == NULL ? 0 : HKF_MATCH_IP);
for (i = 0; i < nkeys; i++) {
- if ((want & ctx.match_keys[i]) == want)
+ if (keys[i] == NULL || (want & ctx.match_keys[i]) == want)
continue;
if ((fp = sshkey_fingerprint(keys[i], hash_alg,
SSH_FP_DEFAULT)) == NULL) {