PR26478 UBSAN: mmo.c:2941 null pointer memcpy
[binutils-gdb.git] / bfd / mmo.c
index 5209736a50540b2edc67435ff4bebf3cf2063ae7..92c51a4f6378a51a5481305dd42fa19198724472 100644 (file)
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -2938,7 +2938,8 @@ mmo_write_symbols_and_terminator (bfd *abfd)
   if (table == NULL)
     return FALSE;
 
-  memcpy (table, orig_table, count * sizeof (asymbol *));
+  if (count != 0)
+    memcpy (table, orig_table, count * sizeof (asymbol *));
 
   /* Move :Main (if there is one) to the first position.  This is
      necessary to get the same layout of the trie-tree when linking as