Skip to content

Instantly share code, notes, and snippets.

@HorlogeSkynet
Last active August 21, 2017 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HorlogeSkynet/44f898140f0304b9cee8e4bd53440a00 to your computer and use it in GitHub Desktop.
Save HorlogeSkynet/44f898140f0304b9cee8e4bd53440a00 to your computer and use it in GitHub Desktop.
Simple code to show a pretty funny thing in C with pointers
#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