Use safer snprintf rather then sprintf in scp_send()

Signed-off-by: Steven Dake <sdake@redhat.com>
This commit is contained in:
Steven Dake 2012-03-06 08:33:57 +01:00 committed by Daniel Stenberg
parent 8e0cddd01f
commit 4449905ea5

View File

@ -796,8 +796,8 @@ scp_send(LIBSSH2_SESSION * session, const char *path, int mode,
return NULL;
}
sprintf((char *)session->scpSend_command, "scp -%st ",
(mtime || atime)?"p":"");
snprintf((char *)session->scpSend_command, session->scpSend_command_len,
"scp -%st ", (mtime || atime)?"p":"");
cmd_len = strlen((char *)session->scpSend_command);