Module: wine Branch: master Commit: d82cbcf049fb5b85ab69549135bf28229dc769d6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d82cbcf049fb5b85ab69549135...
Author: Juan Lang juan.lang@gmail.com Date: Wed Aug 19 14:27:20 2009 -0700
rpcrt4: Allow Annotation to be NULL.
Fixes bug 19760. --Juan
From afb4d6b943345e19952fe34bd1d8ab4c411563ae Mon Sep 17 00:00:00 2001
From: Juan Lang juan.lang@gmail.com Date: Wed, 19 Aug 2009 14:27:20 -0700 Subject: [PATCH 3/3] Allow Annotation to be NULL
---
dlls/rpcrt4/rpc_epmap.c | 5 +++-- dlls/rpcrt4/tests/rpc_protseq.c | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/rpcrt4/rpc_epmap.c b/dlls/rpcrt4/rpc_epmap.c index 2a03484..60c4255 100644 --- a/dlls/rpcrt4/rpc_epmap.c +++ b/dlls/rpcrt4/rpc_epmap.c @@ -225,7 +225,6 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind RpcBinding* bind = BindingVector->BindingH[i]; for (j = 0; j < (UuidVector ? UuidVector->Count : 1); j++) { - int len = strlen((char *)Annotation); status = TowerConstruct(&If->InterfaceId, &If->TransferSyntax, bind->Protseq, bind->Endpoint, bind->NetworkAddr, @@ -236,7 +235,9 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind memcpy(&entries[i * UuidVector->Count].object, &UuidVector->Uuid[j], sizeof(GUID)); else memset(&entries[i].object, 0, sizeof(entries[i].object)); - memcpy(entries[i].annotation, Annotation, min(len + 1, ept_max_annotation_size)); + if (Annotation) + memcpy(entries[i].annotation, Annotation, + min(strlen((char *)Annotation) + 1, ept_max_annotation_size)); } }
diff --git a/dlls/rpcrt4/tests/rpc_protseq.c b/dlls/rpcrt4/tests/rpc_protseq.c index 4837f6a..3acc38b 100644 --- a/dlls/rpcrt4/tests/rpc_protseq.c +++ b/dlls/rpcrt4/tests/rpc_protseq.c @@ -157,6 +157,9 @@ static void test_endpoint_mapper(RPC_CSTR protseq, RPC_CSTR address) /* register endpoints created in test_RpcServerUseProtseq */ status = RpcEpRegisterA(IFoo_v0_0_s_ifspec, binding_vector, NULL, annotation); ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %u\n", protseq, status); + /* reregister the same endpoint with no annotation */ + status = RpcEpRegisterA(IFoo_v0_0_s_ifspec, binding_vector, NULL, NULL); + ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %u\n", protseq, status);
status = RpcStringBindingCompose(NULL, protseq, address, NULL, NULL, &binding);