Skip to content

Instantly share code, notes, and snippets.

@Inndy
Created August 4, 2014 17:36
Show Gist options
  • Save Inndy/9bad01f987a8e0c16221 to your computer and use it in GitHub Desktop.
Save Inndy/9bad01f987a8e0c16221 to your computer and use it in GitHub Desktop.
DONT COPY THIS! VULNERABLE CODE!
/* DONT COPY THIS! VULNERABLE CODE! */
#include <stdio.h>
void read_the_file (FILE *fp) {
char buffer[8];
fgets(buffer, 72, fp); // 72bytes WTF?
}
int main (int argc, const char *argv[]) {
if (argc < 2) {
printf("Usage: %s input.dat\n", argv[0]);
return 1;
}
FILE *fp = fopen(argv[1], "rb");
read_the_file(fp);
fclose(fp);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment