diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 48476b63a..032f27cf4 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -6,6 +6,7 @@ #include "util/binary.h" #include +#include #ifdef __FreeBSD__ #include #ifndef _PATH_LOCALBASE @@ -85,8 +86,10 @@ static bool getShellVersionFish(FFstrbuf* exe, FFstrbuf* version) if(!getExeVersionRaw(exe, version)) return false; - //fish, version 4.0.2-1 (Built by MSYS2 project) - ffStrbufSubstrAfterFirstS(version, "version "); + //fish, version 4.0.2-1 (Built by MSYS2 project) // version can be localized if LC_ALL is set + if (version->length < strlen("fish, v")) return false; + uint32_t index = ffStrbufNextIndexC(version, strlen("fish, "), ' '); + ffStrbufSubstrAfter(version, index); ffStrbufSubstrBeforeFirstC(version, ' '); return true; }