1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

LibELF: Ensure that DynamicLoader only receives absolute paths

While at it, start renaming variables where we know that they store a
path, so that we will get less confused in the future.
This commit is contained in:
Tim Schumacher 2022-10-28 16:30:27 +02:00 committed by Linus Groh
parent a1de15498d
commit 177a5baf60
5 changed files with 23 additions and 16 deletions

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/LexicalPath.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/StringView.h>
@ -232,7 +233,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
{
TRY(Core::System::pledge("stdio rpath"));
StringView path {};
String path {};
static bool display_all = false;
static bool display_elf_header = false;
static bool display_program_headers = false;
@ -288,6 +289,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
display_hardening = true;
}
path = LexicalPath::absolute_path(TRY(Core::System::getcwd()), path);
auto file_or_error = Core::MappedFile::map(path);
if (file_or_error.is_error()) {