我最近一直在研究buffer overflow和vulnerable 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之前的网格中排列?任何提示或更好的解决方案表示赞赏。谢谢