Visual Studio 2017 链接器出现错误 C4789

Woo*_*y20 5 c++ visual-studio

这是 64 位 Windows 7、Visual Studio 2017、C++ 项目。

当我使用编译器选项进行发布构建时,/sdl我收到错误 4789(如果/sdl未启用,这是一个警告)。

1>Finished searching libraries
1>Generating code
1>c:\program files (x86)\windows kits\10\include\10.0.10586.0\ucrt\corecrt_memcpy_s.h(50): error C4789: buffer 'buffer' of size 262144 bytes will be overrun; 262143 bytes will be written starting at offset 2
1>All 2506 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Run Code Online (Sandbox Code Playgroud)

我想找出错误的原因。阅读 C4789 上的 MS 文档表明,存在函数memsetwmemsetmemcpy之一strcpy,它指定操作长度 > 目标长度。此外,这必须在编译/链接时知道,这意味着目标大小和操作长度都是常量。

我的困难在于,在我的项目中实际上有数百次使用命名函数,并且链接器无法识别哪一个是错误的。我还只搜索了那些目的地名为“ buffer”的目的地,但没有成功。

有什么办法可以缩小错误原因吗?