ios - Swift 和 Stack 粉碎保护

标签 ios swift xcode security

如何在纯 swift 应用程序中启用 Stack Smashing Protection?

我确实尝试在 xCode 的项目build设置选项卡下将“-fstack-protector-all”标志放入其他 C++ 标志,但似乎该标志未使用或对构建的应用程序没有影响。

为了验证构建,我正在使用 otool -Iv AppBinary | grep 堆栈

最佳答案

在 Swift 中,Stack smashing 默认启用,只需要在 objective-c 应用程序的build设置下添加“-fstack-protector-all”标志。

如何检查堆栈粉碎是否启用。 运行 otool 命令并出现 stack_chk_guardstack_chk_fail 表示代码受堆栈粉碎保护。

$ otool -Iv <appname>|grep stack
0x0013dfg   520 ___stack_chk_fail
0x001d009   521 ___stack_chk_guard
0x001fd345   520 ___stack_chk_fail
0x000000010087efd   513 ___stack_chk_fail
0x0000000100098hf3 514 ___stack_chk_guard
0x00000001000897gfr   513 ___stack_chk_fail

关于ios - Swift 和 Stack 粉碎保护,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38564924/

相关文章:

ios - Estimote室内导航sdk崩溃

ios - iOS 应用程序中的条形图

ios - 如何为多个 UIView 添加撤消管理器

ios - "*** Terminating app due to uncaught exception ' NSRangeException ', reason: ' *** -[__NSArrayM objectAtIndex :]: index 1 beyond bounds [0 . 。 0] '"

ios - 显示对应物的 Xcode 快捷方式

ios - Flutter iOS应用程序无法运行,但未找到错误app_settings

iphone - 如何将图像放到 iPad 模拟器上

ios - 转换到另一个 ViewController 时出现黑屏

ios - 获取 rightBarButtonItem 的字体大小

ios - 代码 8 : how to change targeted device family