I have this function:
int vulnerableFunc(char *input)
{
char buffer[256];
memcpy(buffer, input, 1024);
return 1;
}
When I call it with 2000 "A" and dissassemble it with ollydbg on a 32 bit windows XP machine, I get the following addresses on the stack:
22FB6C Ret Addr |
22FB68 Old EBP | |
| 268 |
| | 264
22FA60 Buffer for Writing A | |
22FA5C ?? RETURN from ntdll.7c92755D to ntdll.7C927553 |
22FA58 1024 |
22FA54 SRC - Ptr to 22FBB0 (22FBB0 = A * 2000 (Original Arg to Func)) | 16
22FA50 DEST - Ptr to 22FA60 (Copy is Inc From 22FA60) |
22FA4C local var end (last local var 22FA50)
Q1) I have only allocated 256 bytes of local variable and yet I get 264 bytes from "Buffer for Writing A" until "Old EBP", why is that?
Q2) What is "RETURN from ntdll.7c92755D to ntdll.7C927553" at address 22FA5C? Shouldn't there only be 12 bytes arguments to memcpy?