aboutsummaryrefslogtreecommitdiff
path: root/slides/2018-software-security/sample/assignment-buffer-overflow.c
blob: 2fb0d58b15c3a2f72108e957642212eea6cbd35a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
#include <limits.h>
#define SECRET UINT_MAX

void gotcha() { printf("Gotcha!\n"); }

int main() {
  unsigned secret = 0;
  char buf[8];
  scanf("%s", buf);
  if (secret == SECRET) {
    gotcha();
  }
  return 0;
}