====== Level 8 ====== ssh narnia8@narnia.labs.overthewire.org pass : mohthuphog #include #include #include // gcc's variable reordering fucked things up // to keep the level in its old style i am // making "i" global unti i find a fix // -morla int i; void func(char *b){ char *blah=b; char bok[20]; //int i=0; memset(bok, '\0', sizeof(bok)); for(i=0; blah[i] != '\0'; i++) bok[i]=blah[i]; printf("%s\n",bok); } int main(int argc, char **argv){ if(argc > 1) func(argv[1]); else printf("%s argument\n", argv[0]); return 0; } Nous avons un buffer overflow classique, le seul problème ici c'est que nous allons écrire par dessus notre pointeur qui est utilisé par le programme pour copier notre chaine. Il va donc falloir écrire la bonne valeur sur ce pointeur.