Rob Shearman : rpcrt4: Don' t terminate the loop on the buffer becoming filled, but when we receive a packet with the RPC_FLG_LAST flag set.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Oct 27 05:49:21 CDT 2006


Module: wine
Branch: master
Commit: fbe829cbb1c89771c0115e1196c167be73506612
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fbe829cbb1c89771c0115e1196c167be73506612

Author: Rob Shearman <rob at codeweavers.com>
Date:   Thu Oct 26 23:15:11 2006 +0100

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 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c
index f102cf6..6d434c0 100644
--- a/dlls/rpcrt4/rpc_message.c
+++ b/dlls/rpcrt4/rpc_message.c
@@ -546,7 +546,7 @@ RPC_STATUS RPCRT4_Receive(RpcConnection
   }
   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
       }
     }
 
-    /* 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
 
       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))




More information about the wine-cvs mailing list