knownhosts: Fix and infinite loop when iterating known host entries

Fixes #145

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
This commit is contained in:
Andreas Schneider
2022-09-05 13:20:46 +02:00
parent 2d79c7a9d5
commit 3e4c2205c5

View File

@@ -591,6 +591,8 @@ char *ssh_known_hosts_get_algorithms_names(ssh_session session)
entry = ssh_iterator_value(struct ssh_knownhosts_entry *, it);
algo = ssh_known_host_sigs_from_hostkey_type(entry->publickey->type);
if (algo == NULL) {
ssh_knownhosts_entry_free(entry);
ssh_list_remove(entry_list, it);
continue;
}