Sat Sep 19 22:42:23 1998 Doug Rabson <dfr@nlsystems.com>
[binutils-gdb.git] / bfd / elflink.h
index 5b44aedabb5221aaf9456b04fa5bf7cf6c94b2ba..64f8de80f9870b82894105f4b0218832011318bd 100644 (file)
@@ -717,13 +717,15 @@ elf_link_add_object_symbols (abfd, info)
                }
 
              sz = bfd_section_size (abfd, s);
-             msg = (char *) bfd_alloc (abfd, sz);
+             msg = (char *) bfd_alloc (abfd, sz + 1);
              if (msg == NULL)
                goto error_return;
 
              if (! bfd_get_section_contents (abfd, s, msg, (file_ptr) 0, sz))
                goto error_return;
 
+             msg[sz] = '\0';
+
              if (! (_bfd_generic_link_add_one_symbol
                     (info, abfd, name, BSF_WARNING, s, (bfd_vma) 0, msg,
                      false, collect, (struct bfd_link_hash_entry **) NULL)))