Creating our vulnerable C program without disabling protections

Fire up vim buff.c to prepare a new C file in the Vim editor. Type in the following familiar code:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char **argv) {
printf(" Buffer Copier v1.0 ");
char buff[1024];
if(argc != 2) {
printf(" Usage: %s <data to be stored in buffer> ", argv[0]);
system("echo Exiting");
exit(0);
}
else {
strcpy(buff, argv[1]);
printf("Buffer: %s ", buff);
system("echo Data received.");
return 0;
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.95.38