diff options
author | Pedro Alves <palves@redhat.com> | 2012-12-13 15:11:36 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2012-12-13 15:11:36 +0000 |
commit | aab2f0047212f9f3e647b2e759baf78486c3daa5 (patch) | |
tree | ed164eeb7dae9768c9ab0bce1eb7a14f939b93dd /gdb/coff-pe-read.c | |
parent | 78ea0eca85031f7a37097311f90323347fb89d2d (diff) | |
download | gdb-aab2f0047212f9f3e647b2e759baf78486c3daa5.zip gdb-aab2f0047212f9f3e647b2e759baf78486c3daa5.tar.gz gdb-aab2f0047212f9f3e647b2e759baf78486c3daa5.tar.bz2 |
2012-12-13 Pedro Alves <palves@redhat.com>
* coff-pe-read.c: Include coff/internal.h.
(read_pe_exported_syms): Use SCNNMLEN instead of hardcoded 8.
Null terminate buffer explicitly instead of memset the whole
buffer.
Diffstat (limited to 'gdb/coff-pe-read.c')
-rw-r--r-- | gdb/coff-pe-read.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c index 01b5b82..679ca31 100644 --- a/gdb/coff-pe-read.c +++ b/gdb/coff-pe-read.c @@ -34,6 +34,7 @@ #include "symfile.h" #include "objfiles.h" #include "common/common-utils.h" +#include "coff/internal.h" #include <ctype.h> @@ -458,12 +459,12 @@ read_pe_exported_syms (struct objfile *objfile) unsigned long vsize = pe_get32 (dll, secptr1 + 8); unsigned long vaddr = pe_get32 (dll, secptr1 + 12); unsigned long characteristics = pe_get32 (dll, secptr1 + 36); - char sec_name[9]; + char sec_name[SCNNMLEN + 1]; int sectix; - memset (sec_name, 0, sizeof (sec_name)); bfd_seek (dll, (file_ptr) secptr1 + 0, SEEK_SET); - bfd_bread (sec_name, (bfd_size_type) 8, dll); + bfd_bread (sec_name, (bfd_size_type) SCNNMLEN, dll); + sec_name[SCNNMLEN] = '\0'; sectix = read_pe_section_index (sec_name); |