1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2026-10-24 03:48:55 +03:00

fix: initialize known_hosts output entry

ssh_session_get_known_hosts_entry() could return SSH_KNOWN_HOSTS_OK without initializing *pentry, leaving callers with an undefined output pointer.

Initialize *pentry to NULL at function entry so every return path leaves the output in a defined state.

Signed-off-by: Nuhiat-Arefin <nuhiatarefin@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/814>
(cherry picked from commit 6cd0e6e52a)
This commit is contained in:
Nuhiat-Arefin
2026-04-09 23:47:33 +06:00
committed by Pavol Žáčik
parent 49df3fa0dc
commit ffd06b1cd0

View File

@@ -1183,6 +1183,10 @@ ssh_session_get_known_hosts_entry(ssh_session session,
{
enum ssh_known_hosts_e old_rv, rv = SSH_KNOWN_HOSTS_UNKNOWN;
if (pentry != NULL) {
*pentry = NULL;
}
if (session->opts.knownhosts == NULL) {
if (ssh_options_apply(session) < 0) {
ssh_set_error(session,