diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 84a1390ba4c..2639cc5ccad 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2012-12-13 Pedro Alves + + * 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. + 2012-12-13 Pierre Muller * coff-pe-read.c (IMAGE_SCN_CNT_TEXT, IMAGE_SCN_CNT_INITIALIZED_DATA) diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c index 01b5b82062d..679ca31f7c4 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 @@ -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);