author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Fri, 14 Nov 2014 13:38:30 +0000 | |
changeset 311 | 8befc029ca1e |
parent 222 | 81f9f0eb1180 |
permissions | -rw-r--r-- |
222
81f9f0eb1180
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
200
diff
changeset
|
1 |
char shellcode[] = ... |
200
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
char large_string[128]; |
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
|
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
void main() { |
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
char buffer[96]; |
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
int i; |
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
long *long_ptr = (long *) large_string; |
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
|
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
for (i = 0; i < 32; i++) |
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
*(long_ptr + i) = (int) buffer; |
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
|
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
for (i = 0; i < strlen(shellcode); i++) |
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
large_string[i] = shellcode[i]; |
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
|
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
15 |
strcpy(buffer,large_string); |
17852f5397fd
added original smashing for fun files
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
16 |
} |