Skip to content

Instantly share code, notes, and snippets.

@Katharine
Created May 16, 2012 18:11
Show Gist options
  • Save Katharine/2712712 to your computer and use it in GitHub Desktop.
Save Katharine/2712712 to your computer and use it in GitHub Desktop.
Clobber i by overflowing s
#include <stdio.h>
struct foo {
char s[4];
int i;
};
int main() {
struct foo f;
f.i = 10;
printf("Enter a string: ");
scanf("%s", f.s);
printf("i: %d\n", f.i);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment