From 15428534d85918093ed01c169ebbf136cf9cca94 Mon Sep 17 00:00:00 2001 From: Damjan Jovanovic Date: Sun, 15 Jul 2007 13:58:31 +0200 Subject: [PATCH] ws2_32: Update WSASendTo's iovec properly. --- dlls/ws2_32/socket.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 60c4e44c50c..0a6597daf31 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2717,13 +2717,11 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, if (n > 0) { *lpNumberOfBytesSent += n; - if (iovec[first_buff].iov_len > n) - iovec[first_buff].iov_len -= n; - else - { - while (n > 0) n -= iovec[first_buff++].iov_len; - if (first_buff >= dwBufferCount) break; - } + while (first_buff < dwBufferCount && iovec[first_buff].iov_len <= n) + n -= iovec[first_buff++].iov_len; + if (first_buff >= dwBufferCount) break; + iovec[first_buff].iov_base = (char*)iovec[first_buff].iov_base + n; + iovec[first_buff].iov_len -= n; } if (timeout != -1) -- 2.11.4.GIT