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.

This commit is contained in:
Rob Shearman 2008-03-10 16:42:06 +00:00 committed by Alexandre Julliard
parent 4500836635
commit a5599028ea
1 changed files with 4 additions and 4 deletions

View File

@ -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;