Robert Shearman : rpcrt4: Restrict stubless FC types to the range of the type function table.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Feb 3 12:03:02 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 4d25edc2981b4c2d6be6b1f0cb921e731552b5ee
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=4d25edc2981b4c2d6be6b1f0cb921e731552b5ee

Author: Robert Shearman <rob at codeweavers.com>
Date:   Fri Feb  3 18:46:40 2006 +0100

rpcrt4: Restrict stubless FC types to the range of the type function table.

---

 dlls/rpcrt4/ndr_stubless.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c
index 7c10621..1a45275 100644
--- a/dlls/rpcrt4/ndr_stubless.c
+++ b/dlls/rpcrt4/ndr_stubless.c
@@ -47,9 +47,11 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(rpc);
 
+#define NDR_TABLE_MASK 127
+
 static inline void call_buffer_sizer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 {
-    NDR_BUFFERSIZE m = NdrBufferSizer[pFormat[0]];
+    NDR_BUFFERSIZE m = NdrBufferSizer[pFormat[0] & NDR_TABLE_MASK];
     if (m) m(pStubMsg, pMemory, pFormat);
     else
     {
@@ -60,7 +62,7 @@ static inline void call_buffer_sizer(PMI
 
 static inline unsigned char *call_marshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 {
-    NDR_MARSHALL m = NdrMarshaller[pFormat[0]];
+    NDR_MARSHALL m = NdrMarshaller[pFormat[0] & NDR_TABLE_MASK];
     if (m) return m(pStubMsg, pMemory, pFormat);
     else
     {
@@ -72,7 +74,7 @@ static inline unsigned char *call_marsha
 
 static inline unsigned char *call_unmarshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 {
-    NDR_UNMARSHALL m = NdrUnmarshaller[pFormat[0]];
+    NDR_UNMARSHALL m = NdrUnmarshaller[pFormat[0] & NDR_TABLE_MASK];
     if (m) return m(pStubMsg, ppMemory, pFormat, fMustAlloc);
     else
     {
@@ -84,7 +86,7 @@ static inline unsigned char *call_unmars
 
 static inline void call_freer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 {
-    NDR_FREE m = NdrFreer[pFormat[0]];
+    NDR_FREE m = NdrFreer[pFormat[0] & NDR_TABLE_MASK];
     if (m) m(pStubMsg, pMemory, pFormat);
     else
     {
@@ -95,7 +97,7 @@ static inline void call_freer(PMIDL_STUB
 
 static inline unsigned long call_memory_sizer(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 {
-    NDR_MEMORYSIZE m = NdrMemorySizer[pFormat[0]];
+    NDR_MEMORYSIZE m = NdrMemorySizer[pFormat[0] & NDR_TABLE_MASK];
     if (m) return m(pStubMsg, pFormat);
     else
     {




More information about the wine-cvs mailing list