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:
11
src/scp.c
11
src/scp.c
@@ -335,7 +335,18 @@ int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode)
|
||||
}
|
||||
|
||||
dir = ssh_basename(dirname);
|
||||
if (dir == NULL) {
|
||||
ssh_set_error_oom(scp->session);
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
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);
|
||||
SAFE_FREE(dir);
|
||||
SAFE_FREE(perms);
|
||||
|
||||
Reference in New Issue
Block a user