From 25352982e7256bd3744cd30c5b7938f468693816 Mon Sep 17 00:00:00 2001 From: John Polstra Date: Sat, 19 Sep 1998 22:31:40 +0000 Subject: [PATCH] Fix segmentation violation that sometimes occurred when warning symbols were used. PR: bin/7980 Submitted by: Doug Rabson --- contrib/binutils/bfd/elflink.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/binutils/bfd/elflink.h b/contrib/binutils/bfd/elflink.h index 21bd270c0a4..4389be011ab 100644 --- a/contrib/binutils/bfd/elflink.h +++ b/contrib/binutils/bfd/elflink.h @@ -719,13 +719,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)))