mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 11:09:05 +03:00
LibELF: validate_program_headers: Validate PT_INTERP header p_filesz > 1
This commit is contained in:
parent
1fa9d9dd68
commit
66b0012bfd
Notes:
sideshowbarker
2024-07-18 23:10:37 +09:00
Author: https://github.com/bcoles Commit: https://github.com/SerenityOS/serenity/commit/66b0012bfd2 Pull-request: https://github.com/SerenityOS/serenity/pull/4978
@ -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);
|
||||
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)
|
||||
*interpreter_path = String((const char*)&buffer[program_header.p_offset], program_header.p_filesz - 1);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user