Commit dd0ccdc3d3c74fcb51b0f77b6bcefae58d10fc5c

Alexei Podtelezhnikov 2021-09-28T22:57:58

* src/winfonts/winfnt.c (FNT_Face_Init): Correct reallocation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 4af2f54..9c4b13e 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -897,9 +897,10 @@
 
       font->family_name[family_size] = '\0';
 
-      if ( FT_REALLOC( font->family_name,
-                       family_size,
-                       ft_strlen( font->family_name ) + 1 ) )
+      /* shrink it to the actual length */
+      if ( FT_QREALLOC( font->family_name,
+                        family_size + 1,
+                        ft_strlen( font->family_name ) + 1 ) )
         goto Fail;
 
       root->family_name = font->family_name;