]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Fix file_ploadv_send()/_recv()
authorVolker Lendecke <vl@samba.org>
Tue, 26 Jan 2021 15:39:29 +0000 (16:39 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 28 Jan 2021 16:58:35 +0000 (16:58 +0000)
When reading more than 1024 bytes, don't insert '\0' bytes in between
those chunks.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
source3/lib/util_file.c

index 1c468ea5501debdcc3c7954c86e5e88b8cbe3c0f..2425281f139e6af967bbdba8eb61ded41540c660 100644 (file)
@@ -105,6 +105,13 @@ static void file_ploadv_readable(struct tevent_req *subreq)
        }
 
        bufsize = talloc_get_size(state->buf);
+       if (bufsize > 0) {
+               /*
+                * Last round we've added the trailing '\0'. Remove it
+                * for this round.
+                */
+               bufsize -= 1;
+       }
 
        if (((bufsize + nread) < bufsize) ||
            ((bufsize + nread + 1) < bufsize)) {