1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

client configuration fuzzing and fixes

Signed-off-by: Stanislav Zidek <szidek@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Stanislav Zidek
2021-10-25 20:28:41 +02:00
committed by Jakub Jelen
parent f2f680aede
commit ce26b56e13
3 changed files with 83 additions and 3 deletions

View File

@@ -1156,7 +1156,15 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
case '%':
goto escape;
case 'd':
x = strdup(session->opts.sshdir);
if (session->opts.sshdir) {
x = strdup(session->opts.sshdir);
} else {
ssh_set_error(session, SSH_FATAL,
"Cannot expand sshdir");
free(buf);
free(r);
return NULL;
}
break;
case 'u':
x = ssh_get_local_username();
@@ -1167,10 +1175,26 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
}
break;
case 'h':
x = strdup(session->opts.host);
if (session->opts.host) {
x = strdup(session->opts.host);
} else {
ssh_set_error(session, SSH_FATAL,
"Cannot expand host");
free(buf);
free(r);
return NULL;
}
break;
case 'r':
x = strdup(session->opts.username);
if (session->opts.username) {
x = strdup(session->opts.username);
} else {
ssh_set_error(session, SSH_FATAL,
"Cannot expand username");
free(buf);
free(r);
return NULL;
}
break;
case 'p':
if (session->opts.port < 65536) {