mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:57:34 +00:00
LibELF: validate_program_headers: Validate PT_INTERP header p_filesz > 1
This commit is contained in:
parent
1fa9d9dd68
commit
66b0012bfd
1 changed files with 5 additions and 0 deletions
|
@ -222,6 +222,11 @@ bool validate_program_headers(const Elf32_Ehdr& elf_header, size_t file_size, co
|
||||||
dbgln("Found PT_INTERP header ({}), but the .interp section was not within the buffer :(", header_index);
|
dbgln("Found PT_INTERP header ({}), but the .interp section was not within the buffer :(", header_index);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (program_header.p_filesz <= 1) {
|
||||||
|
if (verbose)
|
||||||
|
dbgln("Found PT_INTERP header ({}), but p_filesz is invalid ({})", header_index, program_header.p_filesz);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (interpreter_path)
|
if (interpreter_path)
|
||||||
*interpreter_path = String((const char*)&buffer[program_header.p_offset], program_header.p_filesz - 1);
|
*interpreter_path = String((const char*)&buffer[program_header.p_offset], program_header.p_filesz - 1);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue