]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
- Fixed a potential data loss in Curl_client_write() when the transfer is
authorMichal Marek <mmarek@suse.cz>
Thu, 13 Nov 2008 08:20:23 +0000 (08:20 +0000)
committerMichal Marek <mmarek@suse.cz>
Thu, 13 Nov 2008 08:20:23 +0000 (08:20 +0000)
  paused.

CHANGES
lib/sendf.c

diff --git a/CHANGES b/CHANGES
index dc66f9e29f54b08ec6b1c842a000b3d1a96bc91b..e30f89c02e7f00ac1444bf401a5c2abc5d3fc8f3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Michal Marek (13 Nov 2008)
+- Fixed a potential data loss in Curl_client_write() when the transfer is
+  paused.
+
 Daniel Stenberg (11 Nov 2008)
 - Rainer Canavan filed bug #2255627
   (http://curl.haxx.se/bug/view.cgi?id=2255627) which pointed out that a
index 4fe0b4806c780cd4a71f0cb736b1e69d1437f760..566e26aa671afa576f0947e3f483673b179980c0 100644 (file)
@@ -425,7 +425,7 @@ static CURLcode pausewrite(struct SessionHandle *data,
 }
 
 
-/* client_write() sends data to the write callback(s)
+/* 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.
@@ -442,6 +442,9 @@ CURLcode Curl_client_write(struct connectdata *conn,
   struct SessionHandle *data = conn->data;
   size_t wrote;
 
+  if(0 == len)
+    len = strlen(ptr);
+
   /* If reading is actually paused, we're forced to append this chunk of data
      to the already held data, but only if it is the same type as otherwise it
      can't work and it'll return error instead. */
@@ -469,9 +472,6 @@ CURLcode Curl_client_write(struct connectdata *conn,
     return CURLE_OK;
   }
 
-  if(0 == len)
-    len = strlen(ptr);
-
   if(type & CLIENTWRITE_BODY) {
     if((conn->protocol&PROT_FTP) && conn->proto.ftpc.transfertype == 'A') {
 #ifdef CURL_DOES_CONVERSIONS