Rob Shearman : rpcrt4: Replace sizeofs with FIELD_OFFSET in RPCRT4_BuildBindNackHeader to avoid relying on ANYSIZE_ARRAY being 1 .

Alexandre Julliard julliard at winehq.org
Thu Nov 12 10:22:10 CST 2009


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

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Thu Nov 12 10:31:00 2009 +0000

rpcrt4: Replace sizeofs with FIELD_OFFSET in RPCRT4_BuildBindNackHeader to avoid relying on ANYSIZE_ARRAY being 1.

---

 dlls/rpcrt4/rpc_message.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c
index 50db20c..535d173 100644
--- a/dlls/rpcrt4/rpc_message.c
+++ b/dlls/rpcrt4/rpc_message.c
@@ -226,13 +226,13 @@ RpcPktHdr *RPCRT4_BuildBindNackHeader(ULONG DataRepresentation,
 {
   RpcPktHdr *header;
 
-  header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(header->bind_nack));
+  header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(RpcPktHdr, bind_nack.protocols[1]));
   if (header == NULL) {
     return NULL;
   }
 
   RPCRT4_BuildCommonHeader(header, PKT_BIND_NACK, DataRepresentation);
-  header->common.frag_len = sizeof(header->bind_nack);
+  header->common.frag_len = FIELD_OFFSET(RpcPktHdr, bind_nack.protocols[1]);
   header->bind_nack.reject_reason = RejectReason;
   header->bind_nack.protocols_count = 1;
   header->bind_nack.protocols[0].rpc_ver = RpcVersion;




More information about the wine-cvs mailing list