From 6210f62b1d6f20e72fd2403c77de2831f3c7d519 Mon Sep 17 00:00:00 2001 From: Thijs Waalen Date: Sun, 16 Jan 2022 20:12:57 +0100 Subject: [PATCH] readelf: Fall back to default interpreter path on empty path This fixes readelf failing to map the interpreter for dynamic libraries. When an ELF does not have the PT_INTERP header the StringView will be of the inline capacity of the StringBuilder, not a null StringView. This would cause readelf not to fallback on the default interpreter path. --- Userland/Utilities/readelf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Utilities/readelf.cpp b/Userland/Utilities/readelf.cpp index 66a99ba958..5aae35b4d0 100644 --- a/Userland/Utilities/readelf.cpp +++ b/Userland/Utilities/readelf.cpp @@ -311,7 +311,7 @@ int main(int argc, char** argv) RefPtr object = nullptr; if (elf_image.is_dynamic()) { - if (interpreter_path.is_null()) { + if (interpreter_path.is_empty()) { interpreter_path = "/usr/lib/Loader.so"sv; warnln("Warning: Dynamic ELF object has no interpreter path. Using: {}", interpreter_path); }