From d0b72c545781e5f4c7b5434db1ea53a2a8144e07 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Sat, 3 Aug 2024 08:17:14 +0800 Subject: [PATCH] Shell (Linux): remove version detection for unknown shells It's a dangerous operation. Should fix #1144 --- src/detection/terminalshell/terminalshell.c | 26 ++------------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 230b515c1..9d65bde3a 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -200,28 +200,6 @@ static bool getShellVersionWinPowerShell(FFstrbuf* exe, FFstrbuf* version) NULL }) == NULL; } -#else -static bool getShellVersionGeneric(FFstrbuf* exe, const char* exeName, FFstrbuf* version) -{ - FF_STRBUF_AUTO_DESTROY command = ffStrbufCreate(); - ffStrbufAppendS(&command, "printf \"%s\" \"$"); - ffStrbufAppendTransformS(&command, exeName, toupper); - ffStrbufAppendS(&command, "_VERSION\""); - - if (ffProcessAppendStdOut(version, (char* const[]) { - "env", - "-i", - exe->chars, - "-c", - command.chars, - NULL - }) != NULL) - return false; - - ffStrbufSubstrBeforeFirstC(version, '('); - ffStrbufRemoveStrings(version, 2, (const char*[]) { "-release", "release" }); - return true; -} #endif bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version) @@ -261,9 +239,9 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version) return getShellVersionWinPowerShell(exe, version); return getFileVersion(exe->chars, version); - #else - return getShellVersionGeneric(exe, exeName, version); #endif + + return false; } FF_MAYBE_UNUSED static bool getTerminalVersionTermux(FFstrbuf* version)