summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/headers/pe_get_image_section_tbl_addr.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/headers/pe_get_image_section_tbl_addr.c b/src/headers/pe_get_image_section_tbl_addr.c
index 59ba777..56c55a6 100644
--- a/src/headers/pe_get_image_section_tbl_addr.c
+++ b/src/headers/pe_get_image_section_tbl_addr.c
@@ -40,6 +40,7 @@ struct pe_raw_sec_hdr * pe_get_image_named_section_addr(const void * base, const
size_t len;
uint32_t pos;
uint64_t sname;
+ uint64_t * shname;
if (!(hdr = pe_get_image_section_tbl_addr(base)))
return 0;
@@ -53,6 +54,10 @@ struct pe_raw_sec_hdr * pe_get_image_named_section_addr(const void * base, const
if ((len = pe_impl_strlen_ansi(name)) > 8) {
/* todo: long name support */
return 0;
+
+ } else if (len == 0) {
+ return 0;
+
} else {
sname = 0;
ch = (char *)&sname;
@@ -60,9 +65,12 @@ struct pe_raw_sec_hdr * pe_get_image_named_section_addr(const void * base, const
for (pos=0; pos<len; pos++)
ch[pos] = name[pos];
- for (; count; hdr++,count--)
- if (*(uint64_t *)hdr->sh_name == sname)
+ for (; count; hdr++,count--) {
+ shname = (uint64_t *)&hdr->sh_name[0];
+
+ if (*shname == sname)
return hdr;
+ }
}
return 0;