I am following a tutorial on http://www.corelan.be/index.php/2009/07/19/exploit-writing-tutorial-part-1-stack-based-overflows/ to learn more about exploits. The scripts shown are in perl and I wanted to write it in C I’m having trouble finding a function similar to “\x41” * 10000 in C. I looked around and found memset to be an option but when I use it I keep getting this error whether I was “A” or “\x41” as the 2nd argument. Here is my code:
#include <string.h>
#include <stdio.h>
int main(void)
{
FILE *crash;
crash = fopen("crash.m3u", "w+");
char junk[10001];
memset(junk, "A", sizeof(junk));
fputs(junk, crash);
fclose(crash);
return 0;
}
Use
In C, there is a huge difference between single quotes
'and double quotes". Single quotes are used forcharvalues, and double quotes are used for string (multiple character, orconst char *) values.