mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Better checking for malformed input
https://github.com/upx/upx/issues modified: p_vmlinx.cpp
This commit is contained in:
parent
276b748aa6
commit
58b122d97d
|
@ -111,9 +111,11 @@ typename T::Shdr const *PackVmlinuxBase<T>::getElfSections()
|
||||||
int j;
|
int j;
|
||||||
for (p = shdri, j= ehdri.e_shnum; --j>=0; ++p) {
|
for (p = shdri, j= ehdri.e_shnum; --j>=0; ++p) {
|
||||||
if (Shdr::SHT_STRTAB==p->sh_type
|
if (Shdr::SHT_STRTAB==p->sh_type
|
||||||
&& (p->sh_size + p->sh_offset) <= (unsigned long)file_size
|
&& p->sh_offset < (unsigned long)file_size
|
||||||
&& p->sh_name < p->sh_size
|
&& p->sh_size <= ((unsigned long)file_size - p->sh_offset)
|
||||||
&& (10+ p->sh_name) <= p->sh_size // 1+ strlen(".shstrtab")
|
&& p->sh_name < (unsigned long)file_size
|
||||||
|
&& 10 <= ((unsigned long)file_size - p->sh_name)
|
||||||
|
// 10 == (1+ strlen(".shstrtab"))
|
||||||
) {
|
) {
|
||||||
delete [] shstrtab;
|
delete [] shstrtab;
|
||||||
shstrtab = new char[1+ p->sh_size];
|
shstrtab = new char[1+ p->sh_size];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user