我写了这个程序:
#include <stdio.h>
main()
{
int n;
n=1;
while (n>0)
{
puts("Write a number: ");
scanf(" %d",&n);
printf("This is the number you wrote: %d\n", n);
}
}
显然绝对没有语法错误,也没有任何编译错误。它完美地编译和构建。
现在,如果我切换这一行:
puts("Write a number: ");
用这个:
printf("Write a number: ");
它编译没有错误,但是当编译对象启动时,它立即停止并弹出一个反病毒警告,说它识别出特洛伊木马。在得出任何结论之前,我构建了它几次,在收到相同的消息后,我在 virustotal.com 和 this 中对其进行了扫描。是结果。
我知道 puts
实际上比 printf
给定目标更正确,但它仍然应该工作得很好。
这里有什么问题吗?
我正在使用 AVG 防病毒软件和 Pelles C 进行编译。
最佳答案
这显然是误报。生成的机器代码恰好类似于恶意软件数据库中的代码。这与 puts()
的使用无关。
关于c - 为什么这个普通的 C 程序被检测为病毒?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19458884/