summaryrefslogtreecommitdiff
path: root/gdb/coff-pe-read.c
diff options
context:
space:
mode:
authorPierre Muller <muller@ics.u-strasbg.fr>2012-12-13 17:08:07 +0000
committerPierre Muller <muller@ics.u-strasbg.fr>2012-12-13 17:08:07 +0000
commit36358e24909353cd9207f90f383e6457468f6d06 (patch)
tree5cfda1aed7bacac74e73474f24124569f452a0eb /gdb/coff-pe-read.c
parent9ca46e837e6b08d8e2061c105c3fd784435e4b49 (diff)
downloadgdb-36358e24909353cd9207f90f383e6457468f6d06.tar.gz
* coff-pe-read.c (pe_text_section_offset): Increase size of sname
local variable and zero terminate it to avoid possible problems in strcmp.
Diffstat (limited to 'gdb/coff-pe-read.c')
-rw-r--r--gdb/coff-pe-read.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index 679ca31f7c4..09eb13e1b75 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;
}