From a5599028ea35884bf4ee40d7437ee6c8bd6698e4 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Mon, 10 Mar 2008 16:42:06 +0000 Subject: [PATCH] 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 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c index 19272afb56f..d86add33ee1 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;