aboutsummaryrefslogtreecommitdiff
path: root/libssh/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libssh/misc.c')
-rw-r--r--libssh/misc.c11
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';