From: Volker Lendecke Date: Tue, 26 Jan 2021 15:39:29 +0000 (+0100) Subject: lib: Fix file_ploadv_send()/_recv() X-Git-Tag: tevent-0.11.0~1870 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=230a89332f51b21384d140f5f6d1fb25f593ccb4;p=thirdparty%2Fsamba.git lib: Fix file_ploadv_send()/_recv() When reading more than 1024 bytes, don't insert '\0' bytes in between those chunks. Signed-off-by: Volker Lendecke Reviewed-by: Samuel Cabrero --- diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index 1c468ea5501..2425281f139 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -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)) {