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.
This commit is contained in:
Pedro Alves 2012-12-13 15:11:36 +00:00
parent 78ea0eca85
commit aab2f00472
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,10 @@
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.
2012-12-13 Pierre Muller <muller@sourceware.org>
* coff-pe-read.c (IMAGE_SCN_CNT_TEXT, IMAGE_SCN_CNT_INITIALIZED_DATA)

View File

@ -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);