mirror of
https://github.com/moparisthebest/curl
synced 2024-11-17 06:55:02 -05:00
ftp: include command in Curl_ftpsend sendbuffer
Commit 8238ba9c5f
inadvertently removed
the actual command to be sent from the send buffer in a refactoring.
Add back copying the command into the buffer. Also add more guards
against malformed input while at it.
Closes #2985
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
This commit is contained in:
parent
60ed8d7276
commit
a9882b90f8
@ -3963,10 +3963,14 @@ CURLcode Curl_ftpsend(struct connectdata *conn, const char *cmd)
|
||||
enum protection_level data_sec = conn->data_prot;
|
||||
#endif
|
||||
|
||||
write_len = strlen(cmd);
|
||||
if(write_len > (sizeof(s) -3))
|
||||
if(!cmd)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
write_len = strlen(cmd);
|
||||
if(!write_len || write_len > (sizeof(s) -3))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
memcpy(&s, cmd, write_len);
|
||||
strcpy(&s[write_len], "\r\n"); /* append a trailing CRLF */
|
||||
write_len += 2;
|
||||
bytes_written = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user