[AFD]: Fix read data corruption when peeking at network data (TDI_RECEIVE_PEEK is specified for a stream socket)

svn path=/trunk/; revision=48403
This commit is contained in:
Cameron Gutman 2010-08-01 23:42:33 +00:00
parent be40e4a043
commit e98fc993d1

View file

@ -80,7 +80,7 @@ static VOID RefillSocketBuffer( PAFD_FCB FCB ) {
static NTSTATUS TryToSatisfyRecvRequestFromBuffer( PAFD_FCB FCB,
PAFD_RECV_INFO RecvReq,
PUINT TotalBytesCopied ) {
UINT i, BytesToCopy = 0,
UINT i, BytesToCopy = 0, FcbBytesCopied = FCB->Recv.BytesUsed;
BytesAvailable =
FCB->Recv.Content - FCB->Recv.BytesUsed;
PAFD_MAPBUF Map;
@ -115,12 +115,13 @@ static NTSTATUS TryToSatisfyRecvRequestFromBuffer( PAFD_FCB FCB,
BytesToCopy));
RtlCopyMemory( Map[i].BufferAddress,
FCB->Recv.Window + FCB->Recv.BytesUsed,
FCB->Recv.Window + FcbBytesCopied,
BytesToCopy );
MmUnmapLockedPages( Map[i].BufferAddress, Map[i].Mdl );
*TotalBytesCopied += BytesToCopy;
FcbBytesCopied += BytesToCopy;
if (!(RecvReq->TdiFlags & TDI_RECEIVE_PEEK)) {
FCB->Recv.BytesUsed += BytesToCopy;