A method, apparatus, and article of manufacture for detecting and preventing
input
data buffer overrun storing a security token containing a randomly generated data
pattern in memory between an input data buffer and memory locations containing
instruction address pointers. First one pushes all arguments to a function onto
the stack data structure and pushes a return address onto the stack data structure
for use in obtaining the memory address for the instruction to be executed upon
completion of the function before it pushes onto the stack data structure a security
token. This security token comprises a randomly generated data value. Next one
allocates memory locations on the stack data structure for use as local variables
within the function, completes the instructions within the function, retrieves
the security token value from the stack data structure; and if the retrieved security
token value is identical to the randomly generated data value, returns from the
function using the return address stored on the stack data structure.