mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 10:40:27 +09:00
config: Avoid NULL dereference if no ssh dir is set
This should never happen while parsing configuration files, but the configuration strings do not have this safeguard. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44619 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
This commit is contained in:
@@ -553,6 +553,10 @@ ssh_config_make_absolute(ssh_session session,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Parsing user config relative to home directory (generally ~/.ssh) */
|
/* Parsing user config relative to home directory (generally ~/.ssh) */
|
||||||
|
if (session->opts.sshdir == NULL) {
|
||||||
|
ssh_set_error_invalid(session);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
outlen = strlen(path) + strlen(session->opts.sshdir) + 1 + 1;
|
outlen = strlen(path) + strlen(session->opts.sshdir) + 1 + 1;
|
||||||
out = malloc(outlen);
|
out = malloc(outlen);
|
||||||
if (out == NULL) {
|
if (out == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user