advanced-exploitation-techniques-x86 / ret2got / ret2got.c
ret2got.c
Raw
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void anyfunction (void) {
	system("someCommand");
}
int main(int argc, char** argv) {
	char* ptr;
	char array[8];
	ptr = array;
	strcpy(ptr, argv[1]);
	printf("Array has %s at %p\n", ptr, &ptr);
	strcpy(ptr, argv[2]);
	printf("Array has %s at %p\n", ptr, &ptr);
}