Last active
August 21, 2017 07:52
-
-
Save HorlogeSkynet/44f898140f0304b9cee8e4bd53440a00 to your computer and use it in GitHub Desktop.
Simple code to show a pretty funny thing in C with pointers
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
#include <stdio.h> | |
#define MAINPARAMETERS 0x10 | |
void blackMagic(int valeur) | |
{ | |
long *p; | |
p = ((long*)((long)&p + 0x24 + MAINPARAMETERS)); | |
*p = valeur; | |
} | |
int main(int argc, char *argv[]) | |
{ | |
int var = 0xDEAD; | |
int nextValue = 0xBABE; | |
blackMagic(nextValue); | |
printf("%x\n", var); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment