summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/content_encoding.c3
-rw-r--r--lib/pop3.c13
-rw-r--r--lib/sendf.c2
-rw-r--r--lib/transfer.c4
4 files changed, 16 insertions, 6 deletions
diff --git a/lib/content_encoding.c b/lib/content_encoding.c
index 77814ac30..a84ff543b 100644
--- a/lib/content_encoding.c
+++ b/lib/content_encoding.c
@@ -985,7 +985,8 @@ new_unencoding_writer(struct Curl_easy *data,
return writer;
}
-/* Write data using an unencoding writer stack. */
+/* Write data using an unencoding writer stack. "nbytes" is not
+ allowed to be 0. */
CURLcode Curl_unencode_write(struct Curl_easy *data,
struct contenc_writer *writer,
const char *buf, size_t nbytes)
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;
diff --git a/lib/sendf.c b/lib/sendf.c
index 17d3d51e3..fa3c5a35d 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -604,7 +604,7 @@ static CURLcode chop_write(struct Curl_easy *data,
/* Curl_client_write() sends data to the write callback(s)
The bit pattern defines to what "streams" to write to. Body and/or header.
- The defines are in sendf.h of course.
+ The defines are in sendf.h of course. "len" is not allowed to be 0.
If CURL_DO_LINEEND_CONV is enabled, data is converted IN PLACE to the
local character encoding. This is a problem and should be changed in
diff --git a/lib/transfer.c b/lib/transfer.c
index 56ad5e612..c31e22e00 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -830,7 +830,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
Make sure that ALL_CONTENT_ENCODINGS contains all the
encodings handled here. */
if(data->set.http_ce_skip || !k->writer_stack) {
- if(!k->ignorebody) {
+ if(!k->ignorebody && nread) {
#ifndef CURL_DISABLE_POP3
if(conn->handler->protocol & PROTO_FAMILY_POP3)
result = Curl_pop3_write(data, k->str, nread);
@@ -840,7 +840,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
nread);
}
}
- else if(!k->ignorebody)
+ else if(!k->ignorebody && nread)
result = Curl_unencode_write(data, k->writer_stack, k->str, nread);
}
k->badheader = HEADER_NORMAL; /* taken care of now */