Rob Shearman : rpcrt4: Check that the input to RPCRT4_strndupW was not NULL before assuming that the string couldn 't be allocated due to lack of memory.

Alexandre Julliard julliard at winehq.org
Mon Mar 10 17:05:07 CDT 2008


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Mon Mar 10 16:42:06 2008 +0000

rpcrt4: Check that the input to RPCRT4_strndupW was not NULL before assuming that the string couldn't be allocated due to lack of memory.

---

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

diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c
index 19272af..d86add3 100644
--- a/dlls/rpcrt4/rpc_binding.c
+++ b/dlls/rpcrt4/rpc_binding.c
@@ -982,9 +982,9 @@ static RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc,
             AuthInfo->nt_identity->Password = RPCRT4_strndupAtoW((const char *)nt_identity->Password, nt_identity->PasswordLength);
         AuthInfo->nt_identity->PasswordLength = nt_identity->PasswordLength;
 
-        if (!AuthInfo->nt_identity->User ||
-            !AuthInfo->nt_identity->Domain ||
-            !AuthInfo->nt_identity->Password)
+        if ((nt_identity->User && !AuthInfo->nt_identity->User) ||
+            (nt_identity->Domain && !AuthInfo->nt_identity->Domain) ||
+            (nt_identity->Password && !AuthInfo->nt_identity->Password))
         {
             HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User);
             HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain);
@@ -1572,7 +1572,7 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
     if (r == RPC_S_OK)
     {
       new_auth_info->server_principal_name = RPCRT4_strdupW(ServerPrincName);
-      if (new_auth_info->server_principal_name)
+      if (!ServerPrincName || new_auth_info->server_principal_name)
       {
         if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
         bind->AuthInfo = new_auth_info;




More information about the wine-cvs mailing list