Possible Duplicate:
how to skip a line doing a buffer overflow in c
I disassembled the main()
function using gdb on RHEL5. Basically I want to change return address to some other instruction in code.
Scenario:
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);
}
I want to skip p = 100 and want to jump on printf call.! In GDB i checkd address of function call.
something --> 0x0804827b
Range of addresses for main()
and function()
--> 0x080.....something.
But in program when I try to get address of variable using &a
, the hex addresses looks like 0xbfeca... something.
Why so? I'm not getting the reason behind this, so I'm not even able to GET the return address or to change return address. How should i proceed? What might be the reason?