1 file changed
+4
-1
lines changedLines changed: 4 additions & 1 deletion
@@ -137,7 +137,7 @@ BYTE *GetTable(struct TTFONT *font, const char *name)
137
137
138
138
offset = getULONG( ptr + 8 );
139
139
length = getULONG( ptr + 12 );
140
- table = (BYTE*)calloc( sizeof(BYTE), length );
140
+ table = (BYTE*)calloc( sizeof(BYTE), length + 2 );
141
141
142
142
try
143
143
{
@@ -160,6 +160,9 @@ BYTE *GetTable(struct TTFONT *font, const char *name)
160
160
free(table);
161
161
throw;
162
162
}
163
+ /* Always NUL-terminate; add two in case of UTF16 strings. */
164
+ table[length] = '\0';
165
+ table[length + 1] = '\0';
163
166
return table;
164
167
}
165
168
0 commit comments