I have this piece of code that I need to modify to demonstrate integer overflow vulnerability. I have never done it before and need a head start.
#include <stdio.h>
int myprintf(char* argv){
printf("%s\n", argv);
return 0;
}
int myprintf2(char* argv){
printf("hello world\n");
return 0;
}
int main(int argc, char** argv){
struct foodata{
int (*fptr)(char*);
int buf[4];
} foo;
foo.buf[0] = 0xdeadbeef;
foo.fptr = myprintf;
foo.buf[0xffffffff] = myprintf2;
foo.fptr(argv[1]);
return 0;
}