samedi 28 mars 2015

Use buffer overflow to print specific text




#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(int argc, char *argv[]){
char a[5];
char b[10];
strcpy(a,"nop");
gets(b);
printf("Hello there %s. Value in a is %s.\n",b,a);
exit(0);
}


I need to make the program print Hello there Leslie. Value in a is Correct.


I try to execute arbitrary input into the program, but I can't seem to make it ignore some input. For example if I run the program and enter:



Leslie\\\\Correct


The program will output Hello there Leslie\\\\Correct. Value in a is Correct. How can I remove the \\\\Correct from the first part using buffer overflow?




Aucun commentaire:

Enregistrer un commentaire