Add source file (don't provide to players)
This commit is contained in:
parent
55f4a1a7f6
commit
add8075bb5
1 changed files with 39 additions and 0 deletions
39
doubly-dangerous/doubly_dangerous.c
Normal file
39
doubly-dangerous/doubly_dangerous.c
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
//compile with:
|
||||||
|
//gcc -m32 -std=c99 -Wall -fno-stack-protector doubly_dangerous.c -o doubly_dangerous
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
void give_flag() {
|
||||||
|
FILE *f = fopen("flag.txt", "r");
|
||||||
|
if (f != NULL) {
|
||||||
|
char c;
|
||||||
|
|
||||||
|
while ((c = fgetc(f)) != EOF) {
|
||||||
|
putchar(c);
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("Failed to open flag file!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv){
|
||||||
|
volatile float modified;
|
||||||
|
char buffer[64];
|
||||||
|
|
||||||
|
modified = 0;
|
||||||
|
printf("Give me a string: \n");
|
||||||
|
gets(buffer);
|
||||||
|
|
||||||
|
if (modified == 11.28125) {
|
||||||
|
printf("Success! Here is your flag:\n");
|
||||||
|
give_flag();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("nope!\n");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue