From 65e8bf6f48c7c6744e2be3c442633692724250be Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Tue, 24 Feb 2009 15:26:44 -0800 Subject: [PATCH] crypt32: Properly NULL-terminate decoded UTF8 strings. --- dlls/crypt32/decode.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c index cda8b62aed1..2c2b543e852 100644 --- a/dlls/crypt32/decode.c +++ b/dlls/crypt32/decode.c @@ -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; } -- 2.11.4.GIT