c - 强化工具缓冲区溢出
问题描述
char tmp[] = "hello world";
char *line;
size_t sz;
sz = strlen(tmp) +1;
line = (char*)malloc(sz);
if (line)
memset(line, 0x00, sz);
使用名为 Fortify 的工具,它将 memset 标记为缓冲区溢出。有谁知道为什么?
解决方案
推荐阅读
- ios - 平均 NewRelic 上的 CPU 使用率
- python-3.x - 如何更改熊猫数据框中列的日期时间格式
- android - CastRemoteDisplayLocalService 可以在自定义接收器中使用吗?
- lua - 以下代码中的“模式”是什么意思?
- flutter - Flutter:当孩子溢出时改变堆栈的大小
- batch-file - 如何为网络驱动器映射创建批处理文件
- webhooks - 在环聊聊天室中启用 webhook
- r - 如何处理“text_field 必须引用字符模式列”?
- javascript - 如何运行多个异步 api 函数,然后在全部完成后调用另一个函数?
- c++ - 知道一个对象是一个整体还是不是一个类类型有什么意义呢?