1

我目前正在通过 Stripe 进行 Capture-the-Flag 活动(如果你还没有看到它,你应该检查一下)。该事件要求您大量查看反汇编的可执行文件,而我对asm的了解生疏。

我一直看到常量0x18显示为某种最小堆栈大小。例如,在分配 char[1024] 数组并调用函数 strcpy() 的函数中,程序集如下所示:

8048484:    55                      push   %ebp
8048485:    89 e5                   mov    %esp,%ebp
8048487:    81 ec 18 04 00 00       sub    $0x418,%esp
804848d:    8b 45 08                mov    0x8(%ebp),%eax
8048490:    89 44 24 04             mov    %eax,0x4(%esp)
8048494:    8d 85 f8 fb ff ff       lea    -0x408(%ebp),%eax
804849a:    89 04 24                mov    %eax,(%esp)
804849d:    e8 e6 fe ff ff          call   8048388 <strcpy@plt>
80484a2:    c9                      leave  
80484a3:    c3                      ret

为什么需要额外的空间?

4

0 回答 0