From: Nikolay Sivov Subject: [PATCH 1/4] dwrite: Properly null-terminate name string when converting to WCHAR Message-Id: <545146C5.3090105@codeweavers.com> Date: Wed, 29 Oct 2014 22:57:57 +0300 --- From ac64d5c8ab989fbf11376b0be031b8d6145698ed Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 29 Oct 2014 22:39:55 +0300 Subject: [PATCH 1/4] dwrite: Properly null-terminate name string when converting to WCHAR --- dlls/dwrite/opentype.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 21b1cb2..6d48f90 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -793,8 +793,9 @@ HRESULT opentype_get_font_strings_from_id(const void *table_data, DWRITE_INFORMA if (codepage) { DWORD len = MultiByteToWideChar(codepage, 0, (LPSTR)(storage_area + offset), length, NULL, 0); - name_string = heap_alloc(sizeof(WCHAR) * len); + name_string = heap_alloc(sizeof(WCHAR) * (len+1)); MultiByteToWideChar(codepage, 0, (LPSTR)(storage_area + offset), length, name_string, len); + name_string[len] = 0; } else { int i; -- 2.1.1