rpcrt4: Check for null endpoint in RpcServerUseProtseqEpExW

Nikolay Sivov bunglehead at gmail.com
Thu Feb 5 13:16:25 CST 2009


Changelog:
    - Check for null endpoint in RpcServerUseProtseqEpExW.
      Installed IE8 RC1 crashes on this call, parameter set is specified in
      test case.

>From 89f889b2c7a754302b599884577b4eba22b3d235 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Thu, 5 Feb 2009 22:03:48 +0300
Subject: Check for null endpoint in RpcServerUseProtseqEpExW

---
 dlls/rpcrt4/rpc_server.c |    6 ++++--
 dlls/rpcrt4/tests/rpc.c  |   15 +++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/rpcrt4/rpc_server.c b/dlls/rpcrt4/rpc_server.c
index b6e058a..e9bed42 100644
--- a/dlls/rpcrt4/rpc_server.c
+++ b/dlls/rpcrt4/rpc_server.c
@@ -775,8 +775,10 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( RPC_WSTR Protseq, UINT MaxCalls, RPC
     return status;
 
   EndpointA = RPCRT4_strdupWtoA(Endpoint);
-  status = RPCRT4_use_protseq(ps, EndpointA);
-  RPCRT4_strfree(EndpointA);
+  if (EndpointA) {
+      status = RPCRT4_use_protseq(ps, EndpointA);
+      RPCRT4_strfree(EndpointA);
+  }
   return status;
 }
 
diff --git a/dlls/rpcrt4/tests/rpc.c b/dlls/rpcrt4/tests/rpc.c
index bf538e4..b815acc 100644
--- a/dlls/rpcrt4/tests/rpc.c
+++ b/dlls/rpcrt4/tests/rpc.c
@@ -830,6 +830,20 @@ static void test_UuidCreate(void)
     }
 }
 
+static void test_RpcServerUseProtseqEpEx(void)
+{
+    RPC_STATUS status;
+    RPC_POLICY policy;
+    static WCHAR protW[] = {'n','c','a','l','r','p','c',0};
+
+    policy.Length        = sizeof( policy );
+    policy.EndpointFlags = 0;
+    policy.NICFlags      = 0;
+
+    status = RpcServerUseProtseqEpExW(protW, 10, NULL, NULL, &policy);
+    ok(status == RPC_S_OK, "Expected RPC_S_OK, got %d\n", status);
+}
+
 START_TEST( rpc )
 {
     static unsigned char ncacn_np[] = "ncacn_np";
@@ -849,4 +863,5 @@ START_TEST( rpc )
     test_endpoint_mapper(ncalrpc, NULL, lrpc_endpoint);
     test_RpcStringBindingFromBinding();
     test_UuidCreate();
+    test_RpcServerUseProtseqEpEx();
 }
-- 
1.5.6.5






More information about the wine-patches mailing list