crypt32: Properly NULL-terminate decoded UTF8 strings.

This commit is contained in:
Juan Lang 2009-02-24 15:26:44 -08:00 committed by Alexandre Julliard
parent f290ec4961
commit 65e8bf6f48

View File

@ -1724,9 +1724,8 @@ static BOOL CRYPT_AsnDecodeUnicodeNameValueInternal(const BYTE *pbEncoded,
case ASN_UTF8STRING:
value->Value.cbData = MultiByteToWideChar(CP_UTF8, 0,
(LPCSTR)pbEncoded + 1 + lenBytes, dataLen,
str, bytesNeeded - sizeof(CERT_NAME_VALUE)) * 2;
value->Value.pbData[value->Value.cbData / sizeof(WCHAR)]
= 0;
str, bytesNeeded - sizeof(CERT_NAME_VALUE)) * sizeof(WCHAR);
*(WCHAR *)(value->Value.pbData + value->Value.cbData) = 0;
value->Value.cbData += sizeof(WCHAR);
break;
}