ssh: only allow not found (nonexistent) HOME

Only succeed if the HOME directory is not found. Otherwise, error.
This commit is contained in:
Edward Thomson
2026-05-06 23:29:31 +01:00
parent 0e95b72277
commit 45567bebb7

View File

@@ -439,7 +439,13 @@ static int load_known_hosts(LIBSSH2_KNOWNHOSTS **hosts, LIBSSH2_SESSION *session
GIT_ASSERT_ARG(hosts);
git_sysdir_expand_homedir_file(&sshdir, SSH_DIR);
if ((error = git_sysdir_expand_homedir_file(&sshdir, SSH_DIR)) < 0) {
if (error == GIT_ENOTFOUND)
error = 0;
goto out;
}
if ((error = git_str_joinpath(&path, git_str_cstr(&sshdir), KNOWN_HOSTS_FILE)) < 0)
goto out;