Original Post
Hey guys,
I have a question about the function stack. I was reading through the overflow tutorial here: http://www.cs.ucsb.edu/~jzhou/security/overflow.html I was doing the first example on a *nix machine and got it to work just fine, so I tried this on a windows machine but I can''t seem to get it to work. I have gotten stuck on determining what the actual addresses in the stack are. I made a really simple function that should print out the stack:
void function()
{
int *i;
int *j;
// get base pointer
__asm {
mov i, ebp
}
// get stack pointer
__asm {
mov j, esp
}
printf ("base: 0x%p\n", i);
printf ("top: 0x%p\n", j);
while (i <= j)
{
printf ("0x%p ", i); printf ("0x%p\n", *i);
++i;
}
}
this is the output i got from it:
base: 0x0012FF78
top: 0x0012FF68
0x0012FF68 0x0050005C
0x0012FF6C 0x006F0072
0x0012FF70 0x0012FF68
0x0012FF74 0x0012FF78
0x0012FF78 0x0012FFC0
it shows the address and its contents. I don''t understand what is what though, there should be the bottom of the stack (0x0012ff68), the top (0x0012ff78) and only a return address in between them, right?
Thanks for all the help!
-brad