diff options
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/misc.c | 11 | ||||
-rw-r--r-- | libssh/options.c | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/libssh/misc.c b/libssh/misc.c index c971367..555c25b 100644 --- a/libssh/misc.c +++ b/libssh/misc.c @@ -597,17 +597,18 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) { const char *p; size_t i, l; - if (strlen(s) > MAX_BUF_SIZE) { - ssh_set_error(session, SSH_FATAL, "string to expand too long"); - return NULL; - } - r = ssh_path_expand_tilde(s); if (r == NULL) { ssh_set_error_oom(session); return NULL; } + if (strlen(r) > MAX_BUF_SIZE) { + ssh_set_error(session, SSH_FATAL, "string to expand too long"); + free(r); + return NULL; + } + p = r; buf[0] = '\0'; diff --git a/libssh/options.c b/libssh/options.c index 4fdd5dc..f87af58 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -425,7 +425,7 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type, if (value == NULL) { SAFE_FREE(session->sshdir); - session->sshdir = ssh_path_expand_tilde("~/.ssh/"); + session->sshdir = ssh_path_expand_tilde("~/.ssh"); if (session->sshdir == NULL) { return -1; } |