diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index b6a4d71bc..0b4ac8b50 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -429,7 +429,9 @@ const FFShellResult* ffDetectShell() { if (result->processName.length > 0) { setShellInfoDetails(result); if (instance.config.general.detectVersion) { - fftsGetShellVersion(result->exePath.length > 0 ? &result->exePath : &result->exe, result->exeName, &result->version); + if (!fftsGetShellVersion(result->exePath.length > 0 ? &result->exePath : &result->exe, result->exeName, &result->version)) { + ffStrbufClear(&result->version); + } } } @@ -484,7 +486,9 @@ const FFTerminalResult* ffDetectTerminal() { if (result->processName.length > 0) { setTerminalInfoDetails(result); if (instance.config.general.detectVersion) { - fftsGetTerminalVersion(&result->processName, result->exePath.length > 0 ? &result->exePath : &result->exe, &result->version); + if (!fftsGetTerminalVersion(&result->processName, result->exePath.length > 0 ? &result->exePath : &result->exe, &result->version)) { + ffStrbufClear(&result->version); + } } } diff --git a/src/detection/terminalshell/terminalshell_windows.c b/src/detection/terminalshell/terminalshell_windows.c index d4b33c19f..462cd1371 100644 --- a/src/detection/terminalshell/terminalshell_windows.c +++ b/src/detection/terminalshell/terminalshell_windows.c @@ -354,7 +354,9 @@ const FFShellResult* ffDetectShell(void) { *ext = '\0'; } if (instance.config.general.detectVersion) { - fftsGetShellVersion(result->exePath.length > 0 ? &result->exePath : &result->exe, tmp, &result->version); + if (!fftsGetShellVersion(result->exePath.length > 0 ? &result->exePath : &result->exe, tmp, &result->version)) { + ffStrbufClear(&result->version); + } } } @@ -415,7 +417,9 @@ const FFTerminalResult* ffDetectTerminal(void) { if (result->processName.length > 0) { setTerminalInfoDetails(result); if (instance.config.general.detectVersion) { - fftsGetTerminalVersion(&result->processName, result->exePath.length > 0 ? &result->exePath : &result->exe, &result->version); + if (!fftsGetTerminalVersion(&result->processName, result->exePath.length > 0 ? &result->exePath : &result->exe, &result->version)) { + ffStrbufClear(&result->version); + } } }