diff options
author | Andreas Schneider <asn@cynapses.org> | 2010-05-31 09:17:54 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cynapses.org> | 2010-05-31 09:17:54 +0200 |
commit | 560e93803804224c137d8dee6eae99ab2296734a (patch) | |
tree | daa9044a35ff95fda19d2c6d84925bde1cac24a1 /libssh/misc.c | |
parent | 2a5d71971c9108d7b8e866c9f2364d4613bc22cb (diff) | |
download | libssh-560e93803804224c137d8dee6eae99ab2296734a.tar.gz libssh-560e93803804224c137d8dee6eae99ab2296734a.tar.xz libssh-560e93803804224c137d8dee6eae99ab2296734a.zip |
misc: Move size check down in ssh_path_expand_escape().
Diffstat (limited to 'libssh/misc.c')
-rw-r--r-- | libssh/misc.c | 11 |
1 files changed, 6 insertions, 5 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'; |