Skip to content

Commit aa9948e

Browse files
committed
using fixed length for memory alloc
1 parent 7b5ff07 commit aa9948e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

shellnoob.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ class ShellNoob():
156156
157157
int main() {
158158
// make sure the memory is RWX to support self-modifying shellcode
159-
char *target = (char *) memalign(4096, sizeof(shellcode));
160-
mprotect(target, sizeof(shellcode), PROT_READ | PROT_WRITE | PROT_EXEC);
161-
memcpy(target, shellcode, sizeof(shellcode));
159+
char *target = (char *) memalign(4096, 2048);
160+
mprotect(target, 2048, PROT_READ | PROT_WRITE | PROT_EXEC);
161+
memcpy(target, shellcode, 2048);
162162
(*(void (*)()) target)();
163163
return 0;
164164
}

0 commit comments

Comments
 (0)