BUG: recv() Causes Data Corruption of Large Buffer

ID: Q168187


The information in this article applies to:


SYMPTOMS

Data buffers passed to the Windows Sockets recv() function have the potential to lose the data they contain. This problem only affects buffers passed to recv(). Data buffers manipulated solely by the application or by APIs other than recv() are not affected by this problem.

More specifically, this problem only affects the first WinSock 2 Update for Windows 95. For additional information about this update, please see the following article in the Microsoft Knowledge Base:

Q182108 Availability of Windows Sockets 2.0 for Windows 95
For additional information about the second version of the WinSock 2 Update for Windows 95, please see the following article in the Microsoft Knowledge Base:
Q184242 WinSock 2.0 Installer for Windows 95 (Ws2setup.exe) Update
NOTE: This problem does not apply to any other Windows platform.


CAUSE

The recv() function accepts a buffer to be filled with data received over a socket connection. For memory management purposes, the system may discard portions of such a buffer to allow other memory activity of the system to proceed successfully. When the system does this, it first checks the memory page's "dirty" bit to determine if the page should be written to the paging file before being discarded. When the memory is later needed, it is retrieved from the paging file intact.

The memory pages touched by recv() are supposed to be marked "dirty" when modified so that the pages will be properly written to the system paging file before the memory is discarded. In Windows 95, the pages are not marked "dirty." This causes the pages to be discarded without first being written to the paging file. When the data is later needed by the application, it is treated similar to newly-allocated zero-initialized memory. Such data received over the socket connection earlier is now lost.


RESOLUTION

Install the latest update to WinSock 2 for Windows 95 as described in the following article in the Microsoft Knowledge Base:

Q184242 WinSock 2.0 Installer for Windows 95 (Ws2setup.exe) Update


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

Additional query words:


Keywords          : kbnetwork kbAPI kbKernBase kbMMapFiles kbSDKPlatform kbWinOS95bug kbWinsock kbGrpNet 
Version           : winnt:
Platform          : winnt 
Issue type        : kbbug 

Last Reviewed: February 14, 1999