I was just trying to get a buffer overflow for working with OSX (10.6) in the following program; I need to execute foo by overflowing the buffer.
#include <string.h>
#include <stdio.h>
void foo() {
printf("hacked!");
}
int main(int argc, const char *argv[]) {
char s[100];
strcpy(s, argv[1]);
}
I will compile it as: -
$ gcc -o test test.c -arch i386
When disassembling, testI get the address fooas 0x00001eda. Operation is not working properly; probably because the return address must be full using 0x00001edac contains \x00.
In cases where the destination address has \x00, how can a buffer overflow exploit be performed?
user277465
source
share