[pcf] Fix Savannah bug #35603. * src/pcf/pcfread.c (pcf_get_properties): Assure final zero byte in `strings' array.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/ChangeLog b/ChangeLog
index 5bca087..9a98b10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2012-02-25 Werner Lemberg <wl@gnu.org>
+ [pcf] Fix Savannah bug #35603.
+
+ * src/pcf/pcfread.c (pcf_get_properties): Assure final zero byte in
+ `strings' array.
+
+2012-02-25 Werner Lemberg <wl@gnu.org>
+
[type42] Fix Savannah bug #35602.
* src/type42/t42parse.c (t42_parse_sfnts): Check `string_size' more
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index f8c2a23..d9914c0 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -2,8 +2,7 @@
FreeType font driver for pcf fonts
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2010 by
+ Copyright 2000-2010, 2012 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -496,7 +495,8 @@ THE SOFTWARE.
goto Bail;
}
- if ( FT_NEW_ARRAY( strings, string_size ) )
+ /* allocate one more byte so that we have a final null byte */
+ if ( FT_NEW_ARRAY( strings, string_size + 1 ) )
goto Bail;
error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size );