I am trying to run this piece of vulnerable C code:
#include <stdio.h>
#include <stdlib.h>
int add(int x, int y)
{
int z =10;
z = x + y;
return z;
}
main(int argc, char **argv)
{
int a = atoi(argv[1]);
int b = atoi(argv[2]);
int c;
char buffer[100];
gets(buffer);
puts(buffer);
c = add(a,b);
printf("Sum of %d+%d = %d\n",a, b, c);
exit(0);
}
I am trying to get past the segmentation fault so that I can input the integers but the segmentation fault prevents that. In the terminal I have tried:
I still get a segmentation fault. I am lost as to what to try next. As you can probably tell, I am an ubuntu newb. The bash code I am using comes from here:
http://www.evanjones.ca/buffer-overflow-101.html
I have been at this for while so would really appreciate some help
Cheers
Just explaining what hmjd is asking you to do.
Run (binary) 10 20
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.