It’s said that the leave instruction is the same as :
mov esp,ebp
pop ebp
But what is mov esp,ebp here for? It doesn’t seem valid to me…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
mov esp,ebpsets the stack pointer to the base frame address, effectively releasing the whole frame. (Don’t forget that this is Intel syntax, the destination comes first.) If you didn’t do it, once you callret, you would still be using the called function’s stack frame with your calling function, with crashtastic consequences.