1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <stdio.h> // http://community.coresecurity.com/~gera/InsecureProgramming/stack1.html // int main(int argc, const char *argv[]) { int cookie; char buf[80]; printf("buf: %08x cookie: %08x\n", &buf, &cookie); gets(buf); if (cookie == 0x41424344) { printf("you win!\n"); } return 0; }