summaryrefslogtreecommitdiffhomepage
path: root/src/reader
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-02-03 00:38:48 -0500
committermidipix <writeonce@midipix.org>2017-02-03 00:40:52 -0500
commit4348f399e9a5aa6c062a4fa5d62d77a929781238 (patch)
tree497690d7ad559cc80f6d87071799c80e72f5efc6 /src/reader
parent2dddcfb1889ee04d43adbcf80c0a5187bfc17a52 (diff)
downloadperk-4348f399e9a5aa6c062a4fa5d62d77a929781238.tar.bz2
perk-4348f399e9a5aa6c062a4fa5d62d77a929781238.tar.xz
pe_read_optional_header_structs(): properly initialize pdir (rva's and sizes).
Diffstat (limited to 'src/reader')
-rw-r--r--src/reader/pe_read_optional_header.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/reader/pe_read_optional_header.c b/src/reader/pe_read_optional_header.c
index 88dfb1c..d5524d0 100644
--- a/src/reader/pe_read_optional_header.c
+++ b/src/reader/pe_read_optional_header.c
@@ -15,6 +15,7 @@ static int pe_read_optional_header_structs(const union pe_raw_opt_hdr * p, struc
unsigned int i;
struct pe_block * pdir;
const unsigned char * mark;
+ const unsigned char * etbl;
struct pe_raw_opt_hdr_std * astd;
struct pe_raw_opt_hdr_vers * avers;
@@ -31,6 +32,7 @@ static int pe_read_optional_header_structs(const union pe_raw_opt_hdr * p, struc
aalign = (struct pe_raw_opt_hdr_align *)&p->opt_hdr_32.coh_section_align;
aimg = (struct pe_raw_opt_hdr_img *)&p->opt_hdr_32.coh_size_of_image;
aldr = (struct pe_raw_opt_hdr_ldr *)&p->opt_hdr_32.coh_loader_flags;
+ etbl = p->opt_hdr_32.coh_export_tbl;
break;
case PE_MAGIC_PE32_PLUS:
@@ -39,6 +41,7 @@ static int pe_read_optional_header_structs(const union pe_raw_opt_hdr * p, struc
aalign = (struct pe_raw_opt_hdr_align *)&p->opt_hdr_64.coh_section_align;
aimg = (struct pe_raw_opt_hdr_img *)&p->opt_hdr_64.coh_size_of_image;
aldr = (struct pe_raw_opt_hdr_ldr *)&p->opt_hdr_64.coh_loader_flags;
+ etbl = p->opt_hdr_64.coh_export_tbl;
break;
default:
@@ -88,7 +91,7 @@ static int pe_read_optional_header_structs(const union pe_raw_opt_hdr * p, struc
if (m->oh_ldr.coh_rva_and_sizes < 0x10)
memset(&m->oh_dirs,0,sizeof(m->oh_dirs));
- mark = p->opt_hdr_64.coh_export_tbl;
+ mark = etbl;
pdir = &m->oh_dirs.coh_export_tbl;
for (i=0; i<m->oh_ldr.coh_rva_and_sizes; i++) {