1
1

knownhosts: Avoid possible null pointer dereference

CID 1401096

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Этот коммит содержится в:
Andreas Schneider 2019-04-30 08:01:53 +02:00
родитель 3fccb24464
Коммит db8aca69a7

Просмотреть файл

@ -594,21 +594,26 @@ enum ssh_known_hosts_e ssh_session_has_known_hosts_entry(ssh_session session)
return SSH_KNOWN_HOSTS_ERROR; return SSH_KNOWN_HOSTS_ERROR;
} }
rc = ssh_known_hosts_read_entries(host_port, if (session->opts.knownhosts != NULL) {
session->opts.knownhosts, rc = ssh_known_hosts_read_entries(host_port,
&entry_list); session->opts.knownhosts,
if (rc != 0) { &entry_list);
ssh_list_free(entry_list); if (rc != 0) {
return SSH_KNOWN_HOSTS_UNKNOWN; SAFE_FREE(host_port);
ssh_list_free(entry_list);
return SSH_KNOWN_HOSTS_UNKNOWN;
}
} }
rc = ssh_known_hosts_read_entries(host_port, if (session->opts.global_knownhosts != NULL) {
session->opts.global_knownhosts, rc = ssh_known_hosts_read_entries(host_port,
&entry_list); session->opts.global_knownhosts,
SAFE_FREE(host_port); &entry_list);
if (rc != 0) { SAFE_FREE(host_port);
ssh_list_free(entry_list); if (rc != 0) {
return SSH_KNOWN_HOSTS_UNKNOWN; ssh_list_free(entry_list);
return SSH_KNOWN_HOSTS_UNKNOWN;
}
} }
if (ssh_list_count(entry_list) == 0) { if (ssh_list_count(entry_list) == 0) {