scp.c: fix that scp_send may transmit not initialised memory
Fixes ticket 244. Thanks Torsten.
This commit is contained in:
parent
7ca44fbd94
commit
b99204f289
@ -801,12 +801,18 @@ scp_send(LIBSSH2_SESSION * session, const char *path, int mode,
|
||||
|
||||
cmd_len = strlen((char *)session->scpSend_command);
|
||||
|
||||
memset(&session->scpSend_command[cmd_len], 0,
|
||||
session->scpSend_command_len - cmd_len);
|
||||
|
||||
(void)shell_quotearg(path,
|
||||
&session->scpSend_command[cmd_len],
|
||||
session->scpSend_command_len - cmd_len);
|
||||
|
||||
session->scpSend_command[session->scpSend_command_len - 1] = '\0';
|
||||
|
||||
session->scpSend_command_len =
|
||||
strlen((char *)session->scpSend_command);
|
||||
|
||||
_libssh2_debug(session, LIBSSH2_TRACE_SCP,
|
||||
"Opening channel for SCP send");
|
||||
/* Allocate a channel */
|
||||
|
Loading…
x
Reference in New Issue
Block a user