summaryrefslogtreecommitdiff
path: root/src/target/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/image.c')
-rw-r--r--src/target/image.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/target/image.c b/src/target/image.c
index 3fac0571..39df4aef 100644
--- a/src/target/image.c
+++ b/src/target/image.c
@@ -381,6 +381,14 @@ int image_elf_read_headers(image_t *image)
return ERROR_IMAGE_FORMAT_ERROR;
}
+
+ if ((retval = fileio_seek(&elf->fileio, elf->header->e_phoff)) != ERROR_OK)
+ {
+ ERROR("cannot seek to ELF program header table, read failed");
+ return retval;
+ }
+
+
elf->segments = malloc(elf->segment_count*sizeof(Elf32_Phdr));
if ((retval = fileio_read(&elf->fileio, elf->segment_count*sizeof(Elf32_Phdr), (u8*)elf->segments, &read_bytes)) != ERROR_OK)
@@ -1001,3 +1009,4 @@ int image_calculate_checksum(u8* buffer, u32 nbytes, u32* checksum)
return ERROR_OK;
}
+