可能重复:
how to skip a line doing a buffer overflow in c缓冲区溢出(返回地址)
我拆开使用RHEL5上的gdb main()
功能。基本上我想要将代码中的返回地址更改为其他指令。
场景:
function(int a,int b)
{
char buffer[16];
//some operations here..
}
int main()
{
int x = 12;
int y =13;
int p ;
function(x,y);
p = 100;
printf("%d",p);
}
我想跳过P = 100,想跳就printf的电话! 在GDB中我检查函数调用的地址。 > 0x080 .....东西 -
something --> 0x0804827b
为main()
和function()
地址范围。
但在程序中,当我尝试使用&a
获取变量的地址时,十六进制地址看起来像0xbfeca ...。
为什么这么说?我没有得到这个原因,所以我甚至无法获取返回地址或更改返回地址。我应该如何继续?可能是什么原因?
也许** [这个答案](http://stackoverflow.com/questions/5280789/how-to-skip-a-line-doing-a-buffer-overflow-in-c/5571224#5571224)* * to * [如何跳过在c中执行缓冲区溢出的行](http://stackoverflow.com/q/5280789/203667)*可能有些用处。 – jschmier 2011-04-20 18:35:05