From fbe829cbb1c89771c0115e1196c167be73506612 Mon Sep 17 00:00:00 2001 From: Rob Shearman <rob@codeweavers.com> Date: Thu, 26 Oct 2006 23:15:11 +0100 Subject: [PATCH] rpcrt4: Don't terminate the loop on the buffer becoming filled, but when we receive a packet with the RPC_FLG_LAST flag set. This matches what is mentioned in the DCE/RPC specification. --- dlls/rpcrt4/rpc_message.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c index f102cf60d17..6d434c0d7f1 100644 --- a/dlls/rpcrt4/rpc_message.c +++ b/dlls/rpcrt4/rpc_message.c @@ -546,7 +546,7 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, } buffer_length = 0; buffer_ptr = pMsg->Buffer; - while (buffer_length < pMsg->BufferLength) + while (TRUE) { unsigned int header_auth_len = RPC_AUTH_VERIFIER_LEN(&(*Header)->common); @@ -598,16 +598,8 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, } } - /* when there is no more data left, it should be the last packet */ - if (buffer_length == pMsg->BufferLength && - ((*Header)->common.flags & RPC_FLG_LAST) == 0) { - WARN("no more data left, but not last packet\n"); - status = RPC_S_PROTOCOL_ERROR; - goto fail; - } - buffer_length += data_length; - if (buffer_length < pMsg->BufferLength) { + if (!((*Header)->common.flags & RPC_FLG_LAST)) { TRACE("next header\n"); /* read the header of next packet */ @@ -620,8 +612,11 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, buffer_ptr += data_length; first_flag = 0; + } else { + break; } } + pMsg->BufferLength = buffer_length; /* respond to authorization request */ if (common_hdr.ptype == PKT_BIND_ACK && auth_length > sizeof(RpcAuthVerifier)) -- GitLab