summaryrefslogtreecommitdiff
path: root/mld/seg.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mld/seg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mld/seg.c b/mld/seg.c
index 23cf062..ba14cf9 100644
--- a/mld/seg.c
+++ b/mld/seg.c
@@ -43,6 +43,11 @@ static int load_shdr(struct object *obj, struct segment *seg, size_t index)
}
seg->name = &obj->shstrtab->data[name];
+ if (seg->phdr->p_filesz != hdr->sh_size) {
+ ERROR("segment phdr and shdr file sizes to not match");
+ return M_ERROR;
+ }
+
// map bytes
uint32_t len = B32(hdr->sh_size);
uint32_t off = B32(hdr->sh_offset);