Commit f0fa7a67bfc334775b030d95cac763eeb7247436

Werner Lemberg 2016-09-03T06:33:36

[cff] Avoid null pointer passed to FT_MEM_COPY (#48984). * src/cff/cffload.c (cff_index_get_name): Check `byte_len'.

diff --git a/ChangeLog b/ChangeLog
index eae8f2b..5e7cc03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-09-03  Werner Lemberg  <wl@gnu.org>
+
+	[cff] Avoid null pointer passed to FT_MEM_COPY (#48984).
+
+	* src/cff/cffload.c (cff_index_get_name): Check `byte_len'.
+
 2016-09-02  Werner Lemberg  <wl@gnu.org>
 
 	[unix] Enable 64bit support in file system access (#48962).
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 3d1bda9..470fa82 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -602,7 +602,8 @@
 
     if ( !FT_ALLOC( name, byte_len + 1 ) )
     {
-      FT_MEM_COPY( name, bytes, byte_len );
+      if ( byte_len )
+        FT_MEM_COPY( name, bytes, byte_len );
       name[byte_len] = 0;
     }
     cff_index_forget_element( idx, &bytes );