1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:07:34 +00:00

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.
This commit is contained in:
Thijs Waalen 2022-01-16 20:12:57 +01:00 committed by Brian Gianforcaro
parent a9ec0c30eb
commit 6210f62b1d

View file

@ -311,7 +311,7 @@ int main(int argc, char** argv)
RefPtr<ELF::DynamicObject> object = nullptr; RefPtr<ELF::DynamicObject> object = nullptr;
if (elf_image.is_dynamic()) { if (elf_image.is_dynamic()) {
if (interpreter_path.is_null()) { if (interpreter_path.is_empty()) {
interpreter_path = "/usr/lib/Loader.so"sv; interpreter_path = "/usr/lib/Loader.so"sv;
warnln("Warning: Dynamic ELF object has no interpreter path. Using: {}", interpreter_path); warnln("Warning: Dynamic ELF object has no interpreter path. Using: {}", interpreter_path);
} }