Skip to content

Commit

Permalink
use sizeof instead of strlen to get the shellcode size
Browse files Browse the repository at this point in the history
  • Loading branch information
reyammer committed Jul 30, 2013
1 parent 11af2fc commit 7b5ff07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shellnoob.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ class ShellNoob():
int main() {
// make sure the memory is RWX to support self-modifying shellcode
char *target = (char *) memalign(4096, strlen(shellcode));
mprotect(target, strlen(shellcode), PROT_READ | PROT_WRITE | PROT_EXEC);
memcpy(target, shellcode, strlen(shellcode));
char *target = (char *) memalign(4096, sizeof(shellcode));
mprotect(target, sizeof(shellcode), PROT_READ | PROT_WRITE | PROT_EXEC);
memcpy(target, shellcode, sizeof(shellcode));
(*(void (*)()) target)();
return 0;
}
Expand Down

0 comments on commit 7b5ff07

Please sign in to comment.