Nikolay Sivov : dwrite: Properly null-terminate name string when converting to WCHAR.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Oct 30 09:23:14 CDT 2014


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Oct 29 22:39:55 2014 +0300

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;




More information about the wine-cvs mailing list