From: Sjoerd Simons Date: Mon, 25 Jul 2011 16:54:32 +0000 (+0100) Subject: writev_emu: stop on the first incomplete write X-Git-Tag: gnutls_3_0_0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04b6bec750d214fc8bc5b65f99e47f0e251f1f7b;p=thirdparty%2Fgnutls.git writev_emu: stop on the first incomplete write Just like standard writev, we should only move on to the next block if all the previous ones have been successfully written out. Otherwise there is a potential for data loss and/or confusing push functions. Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c index 198a495346..7158433099 100644 --- a/lib/gnutls_buffers.c +++ b/lib/gnutls_buffers.c @@ -325,6 +325,9 @@ _gnutls_writev_emu (gnutls_session_t session, gnutls_transport_ptr_t fd, const g break; total += ret; + + if (ret != giovec[j].iov_len) + break; } if (total > 0)