| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3520374 commit 0067441
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments