[ws2_32] update the iovec properly
Damjan Jovanovic
damjan.jov at gmail.com
Sun Jul 15 06:41:21 CDT 2007
This fixes a serious regression in ws2_32 where non-atomic sends will
end up corrupting data because the iovec (especially iov_base) isn't
updated properly.
Changelog:
* Update the iovec properly.
Damjan Jovanovic
-------------- next part --------------
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 60c4e44..7882b42 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 (iovec[first_buff].iov_len <= n)
+ n -= iovec[first_buff++].iov_len;
+ iovec[first_buff].iov_base = (char*)iovec[first_buff].iov_base + n;
+ iovec[first_buff].iov_len -= n;
+ if (first_buff >= dwBufferCount) break;
}
if (timeout != -1)
More information about the wine-patches
mailing list