From 2bc984a5b1eafa23944fdee26526c342329da870 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 29 Oct 2014 22:39:55 +0300 Subject: [PATCH] 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 21b1cb2fd42..6d48f9016b3 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;