aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-10-01 07:53:55 +0930
committerAlan Modra <amodra@gmail.com>2024-10-01 08:04:14 +0930
commit656f8fbaae34cb37bda5110cbc8c79c6a2aaa847 (patch)
tree72019385bb665cedf42057ceffc78f030de0506c /bfd/elf.c
parent887ae0cf2be5cb10d68b14f16df8faf666f4e43b (diff)
downloadgdb-656f8fbaae34cb37bda5110cbc8c79c6a2aaa847.zip
gdb-656f8fbaae34cb37bda5110cbc8c79c6a2aaa847.tar.gz
gdb-656f8fbaae34cb37bda5110cbc8c79c6a2aaa847.tar.bz2
segv in bfd_elf_get_str_section
Attempting to write a termination NUL to PROT_READ mmap'd memory was a silly idea. PR 32109 * elf.c (bfd_elf_get_str_section): Don't write terminating NUL if missing. * libbfd.c (_bfd_munmap_readonly_temporary): Correct comment.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 9fe031d..c882a66 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -301,7 +301,8 @@ bfd_elf_get_str_section (bfd *abfd, unsigned int shindex)
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: string table [%u] is corrupt"), abfd, shindex);
- shstrtab[shstrtabsize - 1] = 0;
+ shstrtab = NULL;
+ i_shdrp[shindex]->sh_size = 0;
}
i_shdrp[shindex]->contents = shstrtab;
}