advapi32: Remove unnecessary buffer copy in CredMarshalCredentialW.

This commit is contained in:
Thomas Faber 2014-03-29 11:08:34 +01:00 committed by Alexandre Julliard
parent f9fae1b3f6
commit 0868486d17
1 changed files with 3 additions and 8 deletions

View File

@ -1952,18 +1952,13 @@ BOOL WINAPI CredMarshalCredentialW( CRED_MARSHAL_TYPE type, PVOID cred, LPWSTR *
{ {
case CertCredential: case CertCredential:
{ {
char hash[CERT_HASH_LENGTH + 2]; size = (sizeof(cert->rgbHashOfCert) + 2) * 4 / 3;
memcpy( hash, cert->rgbHashOfCert, sizeof(cert->rgbHashOfCert) );
memset( hash + sizeof(cert->rgbHashOfCert), 0, sizeof(hash) - sizeof(cert->rgbHashOfCert) );
size = sizeof(hash) * 4 / 3;
if (!(p = HeapAlloc( GetProcessHeap(), 0, (size + 4) * sizeof(WCHAR) ))) return FALSE; if (!(p = HeapAlloc( GetProcessHeap(), 0, (size + 4) * sizeof(WCHAR) ))) return FALSE;
p[0] = '@'; p[0] = '@';
p[1] = '@'; p[1] = '@';
p[2] = 'A' + type; p[2] = 'A' + type;
len = cred_encode( (const char *)hash, sizeof(hash), p + 3 ); len = cred_encode( (const char *)cert->rgbHashOfCert, sizeof(cert->rgbHashOfCert), p + 3 );
p[len] = 0; p[len + 3] = 0;
break; break;
} }
case UsernameTargetCredential: case UsernameTargetCredential: