diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-06-28 15:21:53 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-06-28 15:21:53 -0700 |
commit | bbe7cd53cb37e5d318c87626a0169987c3841e88 (patch) | |
tree | 17d9a60270486082aa529d704c1840f695aed8a0 /subx | |
parent | 5cce54ebf3088b0411e4026de0545f3f9eb01828 (diff) | |
download | mu-bbe7cd53cb37e5d318c87626a0169987c3841e88.tar.gz |
4281
Diffstat (limited to 'subx')
-rw-r--r-- | subx/020elf.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/subx/020elf.cc b/subx/020elf.cc index be6153fc..bde5cca3 100644 --- a/subx/020elf.cc +++ b/subx/020elf.cc @@ -24,7 +24,7 @@ void load_elf(const string& filename) { free(elf_contents); } -void load_elf_contents(uint8_t* elf_contents, size_t length) { +void load_elf_contents(uint8_t* elf_contents, size_t size) { uint8_t magic[5] = {0}; memcpy(magic, elf_contents, 4); if (0 != memcmp(magic, "\177ELF", 4)) @@ -40,8 +40,8 @@ void load_elf_contents(uint8_t* elf_contents, size_t length) { uint32_t p_memsz = u32_in(&elf_contents[e_phoff + 20]); Mem.resize(p_vaddr + p_memsz); - if (length > p_memsz - p_vaddr) length = p_memsz - p_vaddr; - for (size_t i = 0; i < length; ++i) + if (size > p_memsz - p_vaddr) size = p_memsz - p_vaddr; + for (size_t i = 0; i < size; ++i) Mem.at(p_vaddr + i) = elf_contents[i]; End_of_program = p_vaddr + p_memsz; |