c - Stack-Smashing Protection 错误消息不包含程序名称
问题描述
这是一个非常丑陋的 C 程序:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
char buffer[10];
memcpy(buffer,argv[1],strlen(argv[1]));
printf("%s\n", buffer);
return 0;
}
我正在用 Stack-Smashing Protection 编译这个程序:
$ gcc -fstack-protector smash.c -o smash
这是我在执行期间得到的:
$ ./smash 01234567890
01234567890v?\??nr?!??U
*** stack smashing detected ***: <unknown> terminated
保护工作正常,但我不明白为什么我看到而不是argv[0]
.
解决方案
推荐阅读
- c# - 使用 C# 我想创建一个条形图,显示 excel 列中每个值的计数
- oauth-2.0 - 存储在数据库中的 Json Web 令牌和验证
- angular - 使用 Msal 对 Angular 中的 Azure 广告进行身份验证
- python - 无缓冲的python覆盖率
- javascript - 如何在javascript中更改音频文件编解码器
- c - 一个动画处理图标,纯C
- python - 使用 Kmeans 聚类压缩多个图像
- django - 我使用 distinct() 对吗?
- object - Python vs VBS COM 对象处理
- python - 在不同的数据框中搜索匹配,然后将列重命名为匹配