Buffer Overflow Intro. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle.  http://sfsecurity.pr.erau.edu
Executing subroutines requires stacks to keep track of returns
A stack is like a stack of trays in a cafeteria.  You can only put one on the top or take one off the top.  You can’t touch any in the middle or on the bottom.
 
•If Norman is executing subroutine R and the instruction at mailbox number 37 tells him to call subroutine S at mailbox 82, he writes 37 on a tray and puts (or pushes) it on the stack.  This tray is called a return pointer.  Then he can jump to mailbox 82.
•Then the instruction in mailbox 83 tells him to call subroutine T at mailbox 112 so he writes 83 on a tray and puts (pushes) it on a stack. 
•When subroutine T is finished he grabs the tray off top of the stack (or pops it), sees the 83 written on it, and knows where to resume (84). 
•When S is finished he pops another tray, sees the 37, and can resume where he left off with R (at 38).