Juan Lang : crypt32: Properly NULL-terminate decoded UTF8 strings.

Alexandre Julliard julliard at winehq.org
Wed Feb 25 09:22:38 CST 2009


Module: wine
Branch: master
Commit: 65e8bf6f48c7c6744e2be3c442633692724250be
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=65e8bf6f48c7c6744e2be3c442633692724250be

Author: Juan Lang <juan.lang at gmail.com>
Date:   Tue Feb 24 15:26:44 2009 -0800

crypt32: Properly NULL-terminate decoded UTF8 strings.

---

 dlls/crypt32/decode.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c
index cda8b62..2c2b543 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;
                 }




More information about the wine-cvs mailing list