Code: Select all
08048481 <bufferoverflow>:
8048481: 55 push ebp
8048482: 89 e5 mov ebp,esp
8048484: 83 ec 38 sub esp,0x38
8048487: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
804848a: 89 44 24 04 mov DWORD PTR [esp+0x4],eax
804848e: 8d 45 e4 lea eax,[ebp-0x1c]
8048491: 89 04 24 mov DWORD PTR [esp],eax
8048494: e8 db fe ff ff call 8048374 <strcpy@plt>
8048499: c9 leave
804849a: c3 ret
for some alignment reason or something it does sub esp,0x38
the next 4 statements after that basically put the pointer char * str into esp+0x4 and the address of [ebp-0x1c] (which should point to the buffer[20]) into [esp] then it calls <strcpy@plt>.
What I am confused about is I see no statement that actually puts the values of the buffer[20] on the stack?
They only call the strcpy@plt with [esp] pointing to the random address put on by
Code: Select all
804848e: 8d 45 e4 lea eax,[ebp-0x1c]
So I am wondering what is putting these buffer[20] characters on the stack?
Also is leave necessary what is this doing... I see it right before alot of function ret statements curious.