diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/logic/pe_get_image_meta.c | 7 | ||||
-rw-r--r-- | src/reader/pe_read_coff_header.c | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c index 78b8b91..699b3a2 100644 --- a/src/logic/pe_get_image_meta.c +++ b/src/logic/pe_get_image_meta.c @@ -141,9 +141,14 @@ int pe_get_image_meta(const struct pe_raw_image * image, struct pe_image_meta ** + m->idata[i].import_lookup_tbl_rva - m->hidata->virtual_addr); /* items */ + uint32_t * hint; m->idata[i].count = 0; + if (m->idata[i].import_lookup_tbl_rva) { - for (pitem=m->idata[i].aitems; *(uint32_t *)pitem->hint_name_tbl_rva; pitem++) + pitem = m->idata[i].aitems; + hint = (uint32_t *)pitem->hint_name_tbl_rva; + + for (; *hint; hint=(uint32_t *)((++pitem)->hint_name_tbl_rva)) m->idata[i].count++; if (!(m->idata[i].items = calloc(m->idata[i].count,sizeof(*(m->idata[i].items))))) diff --git a/src/reader/pe_read_coff_header.c b/src/reader/pe_read_coff_header.c index 79ed730..a0a0b7f 100644 --- a/src/reader/pe_read_coff_header.c +++ b/src/reader/pe_read_coff_header.c @@ -6,8 +6,9 @@ int pe_read_coff_header(const struct pe_coff_file_hdr * p, struct pe_meta_coff_file_hdr * m) { - if ((p->signature[0] != 'P') || (p->signature[1] != 'E') - || *(uint16_t *)&p->signature[2]) + uint16_t * pzero = (uint16_t *)&p->signature[2]; + + if ((p->signature[0] != 'P') || (p->signature[1] != 'E') || *pzero) return PERK_BAD_COFF_HEADER; #if (BYTE_ORDER == LITTLE_ENDIAN) |