diff --git a/src/detection/os/os_linux.c b/src/detection/os/os_linux.c index e1371f0ac..1b99c174c 100644 --- a/src/detection/os/os_linux.c +++ b/src/detection/os/os_linux.c @@ -126,8 +126,9 @@ static void getDebianVersion(FFOSResult* result) { FF_STRBUF_AUTO_DESTROY debianVersion = ffStrbufCreate(); ffAppendFileBuffer("/etc/debian_version", &debianVersion); - if (debianVersion.length) - ffStrbufSet(&result->version, &debianVersion); + if (!debianVersion.length) return; + ffStrbufSet(&result->version, &debianVersion); + ffStrbufSet(&result->versionID, &debianVersion); } static void detectOS(FFOSResult* os) diff --git a/src/modules/os/os.c b/src/modules/os/os.c index b905360e6..120f769fc 100644 --- a/src/modules/os/os.c +++ b/src/modules/os/os.c @@ -21,21 +21,20 @@ static void buildOutputDefault(const FFOSResult* os, FFstrbuf* result) else ffStrbufAppend(result, &instance.state.platform.systemName); - #ifdef __APPLE__ - if(os->codename.length > 0) + //Append code name if it is missing + if(os->codename.length > 0 && !ffStrbufContain(result, &os->versionID)) { ffStrbufAppendC(result, ' '); ffStrbufAppend(result, &os->codename); } - #endif //Append version if it is missing - if(os->versionID.length > 0 && ffStrbufFirstIndex(result, &os->versionID) == result->length) + if(os->versionID.length > 0 && !ffStrbufContain(result, &os->versionID)) { ffStrbufAppendC(result, ' '); ffStrbufAppend(result, &os->versionID); } - else if(os->versionID.length == 0 && os->version.length > 0 && ffStrbufFirstIndex(result, &os->version) == result->length) + else if(os->versionID.length == 0 && os->version.length > 0 && !ffStrbufContain(result, &os->version)) { ffStrbufAppendC(result, ' '); ffStrbufAppend(result, &os->version);