diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2022-10-26 08:18:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-26 08:18:40 +0200 |
commit | 55d5db9ddeafec58b7b12325c0c2f7bc6410b53d (patch) | |
tree | 8a68a6d0e7ad9c1c663abc6d8bc276e267fadf0f | |
parent | 80329739f310457254a66efaf7971a8309711ff3 (diff) | |
parent | fc21d139a463c373fb61e5061f73ee737f5e53d0 (diff) | |
download | patchelf-55d5db9ddeafec58b7b12325c0c2f7bc6410b53d.tar.gz |
Merge pull request #411 from Bo98/notes-bounds
Fix out of bounds access when increasing program header table
-rw-r--r-- | src/patchelf.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index b69bf40..f0b5d92 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -701,7 +701,7 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary() /* Some sections may already be replaced so account for that */ unsigned int i = 1; Elf_Addr pht_size = sizeof(Elf_Ehdr) + (phdrs.size() + num_notes + 1)*sizeof(Elf_Phdr); - while( rdi(shdrs.at(i).sh_offset) <= pht_size && i < rdi(hdr()->e_shnum) ) { + while( i < rdi(hdr()->e_shnum) && rdi(shdrs.at(i).sh_offset) <= pht_size ) { if (not haveReplacedSection(getSectionName(shdrs.at(i)))) replaceSection(getSectionName(shdrs.at(i)), rdi(shdrs.at(i).sh_size)); i++; |