mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
CVE-2026-0965 config: Do not attempt to read non-regular and too large configuration files
Changes also the reading of known_hosts to use the new helper function
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit a5eb30dbfd)
This commit is contained in:
@@ -2811,6 +2811,23 @@ static void torture_config_jump(void **state)
|
||||
printf("%s: EOF\n", __func__);
|
||||
}
|
||||
|
||||
/* Invalid configuration files
|
||||
*/
|
||||
static void torture_config_invalid(void **state)
|
||||
{
|
||||
ssh_session session = *state;
|
||||
|
||||
ssh_options_set(session, SSH_OPTIONS_HOST, "Bar");
|
||||
|
||||
/* non-regular file -- ignored (or missing on non-unix) so OK */
|
||||
_parse_config(session, "/dev/random", NULL, SSH_OK);
|
||||
|
||||
#ifndef _WIN32
|
||||
/* huge file -- ignored (or missing on non-unix) so OK */
|
||||
_parse_config(session, "/proc/kcore", NULL, SSH_OK);
|
||||
#endif
|
||||
}
|
||||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
int rc;
|
||||
@@ -2913,6 +2930,9 @@ int torture_run_tests(void)
|
||||
cmocka_unit_test_setup_teardown(torture_config_jump,
|
||||
setup,
|
||||
teardown),
|
||||
cmocka_unit_test_setup_teardown(torture_config_invalid,
|
||||
setup,
|
||||
teardown),
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user