我得到了一个作业任务,要求使用缓冲区溢出来调用一个函数而不需要显式地调用它。代码基本上是这样的:
#include <stdio.h>
#include <stdlib.h>
void g()
{
printf("now inside g()!\n");
}
void f()
{
printf("now inside f()!\n");
// can only modify this section
// cant call g(), maybe use g (pointer to function)
}
int main (int argc, char *argv[])
{
f();
return 0;
}
虽然我不确定如何继续下去。我考虑修改程序计数器的返回地址,以便它直接跳转到g()的地址,但我不知道如何访问它。无论如何,提示将是很好的。