aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2012-12-13 17:08:07 +0000
committerPierre Muller <muller@sourceware.org>2012-12-13 17:08:07 +0000
commitd8f4a83e6a764c215495d682a48e20fbcb6e92bc (patch)
tree9b3374a5cc49c9c44998a0e5192d2a5142a7d96c
parentaab2f0047212f9f3e647b2e759baf78486c3daa5 (diff)
downloadgdb-d8f4a83e6a764c215495d682a48e20fbcb6e92bc.zip
gdb-d8f4a83e6a764c215495d682a48e20fbcb6e92bc.tar.gz
gdb-d8f4a83e6a764c215495d682a48e20fbcb6e92bc.tar.bz2
* coff-pe-read.c (pe_text_section_offset): Increase size of sname
local variable and zero terminate it to avoid possible problems in strcmp.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/coff-pe-read.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2639cc5..4127a83 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-13 Pierre Muller <muller@sourceware.org>
+
+ * coff-pe-read.c (pe_text_section_offset): Increase size of sname
+ local variable and zero terminate it to avoid possible problems
+ in strcmp.
+
2012-12-13 Pedro Alves <palves@redhat.com>
* coff-pe-read.c: Include coff/internal.h.
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index 679ca31..09eb13e 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -672,12 +672,13 @@ pe_text_section_offset (struct bfd *abfd)
/* Get the rva and size of the export section. */
for (i = 0; i < nsections; i++)
{
- char sname[8];
+ char sname[SCNNMLEN + 1];
unsigned long secptr1 = secptr + 40 * i;
unsigned long vaddr = pe_get32 (abfd, secptr1 + 12);
bfd_seek (abfd, (file_ptr) secptr1, SEEK_SET);
- bfd_bread (sname, (bfd_size_type) 8, abfd);
+ bfd_bread (sname, (bfd_size_type) SCNNMLEN, abfd);
+ sname[SCNNMLEN] = '\0';
if (strcmp (sname, ".text") == 0)
return vaddr;
}