Skip to content

Instantly share code, notes, and snippets.

@rtoal
Created November 4, 2013 04:03
Show Gist options
  • Save rtoal/7297912 to your computer and use it in GitHub Desktop.
Save rtoal/7297912 to your computer and use it in GitHub Desktop.
A fun executable to try on a 32-BIT x86 machine. I wrote this years and years and years ago.
/*
* bypass.c
*
* Try this on an x86 machine. It does **not** print "1".
*/
#include <stdio.h>
void weird() {
int a;
*(&a + 2) += 7;
}
int main() {
int x = 0;
weird();
x = 1;
printf("%d\n",x);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment