http://bugs.winehq.org/show_bug.cgi?id=29164
Bug #: 29164 Summary: Swap buffers in GetAcceptExSockaddrs (WS2_async_accept). Product: Wine Version: 1.3.33 Platform: All OS/Version: All Status: UNCONFIRMED Severity: blocker Priority: P2 Component: winsock AssignedTo: wine-bugs@winehq.org ReportedBy: admin@myac.msk.ru Classification: Unclassified
Bug occurs since version 1.3.12.
The functions of WS2_async_accept used the wrong procedure for filling the buffer. Should be reversed and local_addr remote_addr!!!
Should be as follows:
/* WS2 Spec says size param is extra 16 bytes long...what do we put in it? */ addr = ((char *)wsa->buf) + wsa->data_len; len = wsa->local_len - sizeof(int); - WS_getpeername(HANDLE2SOCKET(wsa->accept_socket), + WS_getsockname(HANDLE2SOCKET(wsa->accept_socket), (struct WS_sockaddr *)(addr + sizeof(int)), &len); *(int *)addr = len;
addr += wsa->local_len; len = wsa->remote_len - sizeof(int); - WS_getsockname(HANDLE2SOCKET(wsa->accept_socket), + WS_getpeername(HANDLE2SOCKET(wsa->accept_socket), (struct WS_sockaddr *)(addr + sizeof(int)), &len); *(int *)addr = len;
http://bugs.winehq.org/show_bug.cgi?id=29164
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |00cpxxx@gmail.com
--- Comment #1 from Bruno Jesus 00cpxxx@gmail.com 2011-11-25 11:51:06 CST --- Sorry to bother, it may be obvious to you but can you elaborate a bit more about it? What program is affected and how did you reach that conclusion? I really would like to understand and others less experienced like me might find it helpful too.
http://bugs.winehq.org/show_bug.cgi?id=29164
Vitaliy Margolen vitaliy-bugzilla@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Platform|All |Other OS/Version|All |other Severity|blocker |normal
--- Comment #2 from Vitaliy Margolen vitaliy-bugzilla@kievinfo.com 2011-11-25 12:04:50 CST --- Not a blocker
http://bugs.winehq.org/show_bug.cgi?id=29164
--- Comment #3 from acDev admin@myac.msk.ru 2011-11-25 13:03:36 CST --- (In reply to comment #1)
Sorry to bother, it may be obvious to you but can you elaborate a bit more about it? What program is affected and how did you reach that conclusion? I really would like to understand and others less experienced like me might find it helpful too.
My console IOCP server is used under windows (XP and later) and under wine (1.3.12 and later). I had to do specifically for the wine option in config file that allows you to read remote_addr from different positions. Here is my code:
procedure TIOCPServer.ExtractAddresses(ChangeAddr: Boolean = False); var PLoc, PRem: PSockAddrIn; LLoc, LRem: integer; begin Server.FGetAcceptExSockaddrs(FRecvBuf, FAddrOffset, Addr_Buf_Len, Addr_Buf_Len, PLoc, LLoc, PRem, LRem); FillChar(FLocalAddr, SizeOf(FLocalAddr), 0); FillChar(FRemoteAddr, SizeOf(FRemoteAddr), 0); if ChangeAddr then begin // this is for WINE only !!! if SizeOf(FLocalAddr) = LRem then FLocalAddr := PRem^; if SizeOf(FRemoteAddr) = LLoc then FRemoteAddr := PLoc^; end else begin if SizeOf(FLocalAddr) = LLoc then FLocalAddr := PLoc^; if SizeOf(FRemoteAddr) = LRem then FRemoteAddr := PRem^; end; end;
http://bugs.winehq.org/show_bug.cgi?id=29164
--- Comment #4 from Bruno Jesus 00cpxxx@gmail.com 2011-11-25 13:12:59 CST --- Thank you. It looks reasonable to me. I'll try to create some tests and apply your change to test.
http://bugs.winehq.org/show_bug.cgi?id=29164
acDev admin@myac.msk.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |major
http://bugs.winehq.org/show_bug.cgi?id=29164
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|major |normal
http://bugs.winehq.org/show_bug.cgi?id=29164
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #5 from Bruno Jesus 00cpxxx@gmail.com 2011-11-26 16:00:12 CST --- Patch sent: http://source.winehq.org/patches/data/81296
http://bugs.winehq.org/show_bug.cgi?id=29164
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |743929e4f43c0aa53151256faa8 | |c8c53b35d6b61 Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #6 from Bruno Jesus 00cpxxx@gmail.com 2011-11-28 17:36:55 CST --- Patch commited: http://source.winehq.org/git/wine.git/commit/743929e4f43c0aa53151256faa8c8c5...
http://bugs.winehq.org/show_bug.cgi?id=29164
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org 2011-12-02 13:34:30 CST --- Closing bugs fixed in 1.3.34.