Writing source code is not an easy task, especially in C.

The C source code below shows an example of taking user’s input into an array.

It will show “You Win” if i=1 or “You Lose” for i=0.

Source code.

Since i is initialized to zero, intuitively we know we will always get “You Lose” for this source code.

Well. Not really.

Check for the next figure and you will see it.

Buffer overflow attack.

So, how people hack the security system? Now you’ve seen.


*Tested in Ubuntu 10.04 LTS.

*Special thanks to tansy@utar for his interesting Lab 2 material.

*Click here to download the source code: e0.c.pdf.