"Colin Finck" mail@colinfinck.de writes:
@@ -947,7 +947,8 @@ static void convert_PCREDENTIALW_to_PCREDENTIALA(const CREDENTIALW *CredentialW, if (CredentialW->TargetName) { CredentialA->TargetName = buffer;
string_len = WideCharToMultiByte(CP_ACP, 0, CredentialW->TargetName, -1, CredentialA->TargetName, -1, NULL, NULL);
/* Buffer is guaranteed to be large enough */
string_len = WideCharToMultiByte(CP_ACP, 0, CredentialW->TargetName, -1, CredentialA->TargetName, 0x7FFFFFFF, NULL, NULL);
It would be cleaner to pass the actual buffer size to the function, it's complex enough that it would be easy to inadvertently break the guarantee that the allocated space is large enough.