Commits

Oleg Oshmyan committed 814077d

Convert_multibyteUTF16_to_wchar now properly adds a NUL to its output

  • Participants
  • Parent commits 897df0b

Comments (0)

Files changed (1)

File src/util.cpp

 		BOM_mark_bytes = 2;
 	}
 	
-	wchar_t* utf16_data = (wchar_t*)malloc( sizeof(wchar_t)* glyph_length ); //just to be sure there will be a trailing NULL
-	wmemset(utf16_data, 0, glyph_length);
+	wchar_t* utf16_data = (wchar_t*)malloc( sizeof(wchar_t)* (glyph_length+1) ); //just to be sure there will be a trailing NULL
+	wmemset(utf16_data, 0, glyph_length + 1);
 						
 	for(size_t i = 0; i < glyph_length; i++) {
 #if defined (__ppc__) || defined (__ppc64__)