diff options
author | Daniel Gustafsson <daniel@yesql.se> | 2018-09-13 10:10:18 +0200 |
---|---|---|
committer | Daniel Gustafsson <daniel@yesql.se> | 2018-09-13 10:10:18 +0200 |
commit | a9882b90f82b4bac7b8eff617782a1b59c035a8a (patch) | |
tree | c7187c99d68e0ba72351f97d9d860e1cdb5b230c /lib | |
parent | 60ed8d72760b911ff8f56e02acc083f79b567af6 (diff) |
ftp: include command in Curl_ftpsend sendbuffer
Commit 8238ba9c5f10414a88f502bf3f5d5a42d632984c 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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ftp.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -3963,10 +3963,14 @@ CURLcode Curl_ftpsend(struct connectdata *conn, const char *cmd) enum protection_level data_sec = conn->data_prot; #endif + if(!cmd) + return CURLE_BAD_FUNCTION_ARGUMENT; + write_len = strlen(cmd); - if(write_len > (sizeof(s) -3)) + 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; |