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

SSH-01-006: Add missing NULL check in ssh_scp_push_directory()

Fixes T193

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Andreas Schneider
2019-10-28 14:29:44 +01:00
parent fff4120cbf
commit 8aa2bbd0dc

View File

@@ -335,7 +335,18 @@ int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode)
} }
dir = ssh_basename(dirname); dir = ssh_basename(dirname);
if (dir == NULL) {
ssh_set_error_oom(scp->session);
return SSH_ERROR;
}
perms = ssh_scp_string_mode(mode); perms = ssh_scp_string_mode(mode);
if (perms == NULL) {
SAFE_FREE(dir);
ssh_set_error_oom(scp->session);
return SSH_ERROR;
}
snprintf(buffer, sizeof(buffer), "D%s 0 %s\n", perms, dir); snprintf(buffer, sizeof(buffer), "D%s 0 %s\n", perms, dir);
SAFE_FREE(dir); SAFE_FREE(dir);
SAFE_FREE(perms); SAFE_FREE(perms);