为 C 函数绘制堆栈内存布局

问题描述 投票:0回答:0

我最近一直在研究buffer overflowvulnerable C programs。我一直在研究如何为具有多个缓冲区数组作为局部变量的 C 程序绘制堆栈内存布局。这是代码:

#include <stdio.h>
#include. <string.h>

void CollectFunction(){
   char buffer[20];
   int a;
   char secretCode[30];

  printf("Enter your information: \n");
  gets(buffer);


  SeparateFunction(buffer); // this function collects the input value of buffer
}


int main(){
  CollectFunction();
  
  return 0;
}

附件是我到目前为止的尝试。

问题:是否需要将CollectFunction()的所有局部变量在Return Address之前的网格中排列?任何提示或更好的解决方案表示赞赏。谢谢

c stack-overflow buffer-overflow stack-memory
© www.soinside.com 2019 - 2024. All rights reserved.