From f29980a15b1e55487f9d93f5adcf169bc98046d5 Mon Sep 17 00:00:00 2001 From: bitwitch Date: Fri, 18 Jun 2021 16:41:58 -0400 Subject: [PATCH] LaunchServer: Check if handler programs exist when registering them This adds checks in load_handlers() and load_config() to see if the programs specified in the config files exist before registering them as handlers. Resolves #8121 --- Userland/Services/LaunchServer/Launcher.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Userland/Services/LaunchServer/Launcher.cpp b/Userland/Services/LaunchServer/Launcher.cpp index 04833a32cc..ed3baa0fd1 100644 --- a/Userland/Services/LaunchServer/Launcher.cpp +++ b/Userland/Services/LaunchServer/Launcher.cpp @@ -87,7 +87,8 @@ void Launcher::load_handlers(const String& af_dir) HashTable protocols; for (auto& protocol : af->launcher_protocols()) protocols.set(protocol); - m_handlers.set(app_executable, { Handler::Type::Default, app_name, app_executable, file_types, protocols }); + if (access(app_executable.characters(), X_OK) == 0) + m_handlers.set(app_executable, { Handler::Type::Default, app_name, app_executable, file_types, protocols }); }, af_dir); } @@ -98,6 +99,8 @@ void Launcher::load_config(const Core::ConfigFile& cfg) auto handler = cfg.read_entry("FileType", key).trim_whitespace(); if (handler.is_empty()) continue; + if (access(handler.characters(), X_OK) != 0) + continue; m_file_handlers.set(key.to_lowercase(), handler); } @@ -105,6 +108,8 @@ void Launcher::load_config(const Core::ConfigFile& cfg) auto handler = cfg.read_entry("Protocol", key).trim_whitespace(); if (handler.is_empty()) continue; + if (access(handler.characters(), X_OK) != 0) + continue; m_protocol_handlers.set(key.to_lowercase(), handler); } }