使用string.h和stdio.h编译c程序后出现WindowsDefender木马警告?

WindowsDefender Trojan warning after compiling c program with string.h and stdio.h?

正如您将看到的,我不擅长 C 编程,仍在学习,但我的 WindowsDefender 对我大喊大叫,因为我使用来自 Codeblocks 的 MinGW 编译此代码 IDE。

#include <stdio.h>
#include <string.h>

int main(void){

char *strings[] = {"test", "test"};
char *newStr;
int i;
for(i=0;i<2;i++){
   strcat(newStr, strings[i]);
   printf("%s\n", newStr);
}

return 0;
}

你能帮我解决一下吗,我不知道这是怎么回事。这不是正常问题吗?

最近我在 Microsoft Visual Studio 2019 Community Edition 中用 C 语言编译简单程序时,我一直遇到这个问题。比如这个。

#include <stdio.h>

int main() {

    int a = 10;
    for (int i = 0; i < 5; i++) {
        a--;
        printf("i = %d\n", i);
        if (a == 8) break;
    }
}

问题不在于你的程序(或我的),而是 Windows Defender 变得过于偏执,错误地识别了正常的编译代码。我收到了和你一样的木马警告。危险在于,如果我们因为狼来了而关闭 Defender,那么真正的病毒可能会潜入无人看管的 PC 上。我很想切换到不同的 a/v,例如 AVG,或者切换到 hyper-V 并使用 GCC 或 clang 在 Ubuntu 上编译程序。