Commit a5599028 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

rpcrt4: Check that the input to RPCRT4_strndupW was not NULL before assuming…

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.
parent 45008366
...@@ -982,9 +982,9 @@ static RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, ...@@ -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->Password = RPCRT4_strndupAtoW((const char *)nt_identity->Password, nt_identity->PasswordLength);
AuthInfo->nt_identity->PasswordLength = nt_identity->PasswordLength; AuthInfo->nt_identity->PasswordLength = nt_identity->PasswordLength;
if (!AuthInfo->nt_identity->User || if ((nt_identity->User && !AuthInfo->nt_identity->User) ||
!AuthInfo->nt_identity->Domain || (nt_identity->Domain && !AuthInfo->nt_identity->Domain) ||
!AuthInfo->nt_identity->Password) (nt_identity->Password && !AuthInfo->nt_identity->Password))
{ {
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User); HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User);
HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain); HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain);
...@@ -1572,7 +1572,7 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, ...@@ -1572,7 +1572,7 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
if (r == RPC_S_OK) if (r == RPC_S_OK)
{ {
new_auth_info->server_principal_name = RPCRT4_strdupW(ServerPrincName); 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); if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
bind->AuthInfo = new_auth_info; bind->AuthInfo = new_auth_info;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment