summaryrefslogtreecommitdiff
path: root/lib/pop3.c
diff options
context:
space:
mode:
authorJacob Hoffman-Andrews <github@hoffman-andrews.com>2021-04-27 15:48:01 -0700
committerDaniel Stenberg <daniel@haxx.se>2021-04-29 15:02:32 +0200
commit5c932f8fe9dad94a7417702958ffa9e8db67c549 (patch)
treebe8e86d19e8d19571ec04a351578131f4836a2c5 /lib/pop3.c
parentf4b85d24b21058215dd67e1c804d47c7b4ee2fda (diff)
downloadcurl-5c932f8fe9dad94a7417702958ffa9e8db67c549.tar.gz
lib: fix 0-length Curl_client_write calls
Closes #6954
Diffstat (limited to 'lib/pop3.c')
-rw-r--r--lib/pop3.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/pop3.c b/lib/pop3.c
index ccfebd02a..275ffeada 100644
--- a/lib/pop3.c
+++ b/lib/pop3.c
@@ -1515,8 +1515,17 @@ CURLcode Curl_pop3_write(struct Curl_easy *data, char *str, size_t nread)
if(prev) {
/* If the partial match was the CRLF and dot then only write the CRLF
as the server would have inserted the dot */
- result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)POP3_EOB,
- strip_dot ? prev - 1 : prev);
+ if(strip_dot && prev - 1 > 0) {
+ result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)POP3_EOB,
+ prev - 1);
+ }
+ else if(!strip_dot) {
+ result = Curl_client_write(data, CLIENTWRITE_BODY, (char *)POP3_EOB,
+ prev);
+ }
+ else {
+ result = CURLE_OK;
+ }
if(result)
return result;