/*
================================================== ==========================
Name : ExploitIt.c
Author : SleepProgger
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
================================================== ==========================
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// #define RET 0x08048464 // with exit
#define RET 0x08048434
#define NOP 0x90
#define LEN 100
void weakFunc(void){
printf("r u a wizard ?\n");
// exit(0);
}
void weakFunc2(char *data){
char smallBuffer[LEN];
strcpy(smallBuffer, data);
printf("%s copied\n", data);
}
int main(void) {
int i;
int length = LEN+15;
char toLarge[length];
for (i=0;i<length;++i){
*(toLarge+i) = NOP;
}
*(long *)&toLarge[length-3] = RET;
toLarge[length+1] = '\0';
weakFunc2(toLarge);
return 0;
}


LinkBack URL
About LinkBacks
