Compilation catches strcpy overflow
When running make to compile, there is a strcpy overflow caught in flag_scoreboard.c
Error is below:
CC build/main/flag_scoreboard.o /home/user/esp/ble_ctf_infinity/main/flag_scoreboard.c: In function 'flag_scoreboard_main': /home/user/esp/ble_ctf_infinity/main/flag_scoreboard.c:891:1: error: '__builtin_memcpy' writing 3 bytes into a region of size 2 overflows the destination [-Werror=stringop-overflow=] strcpy(string_total_flags, "10"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors /home/user/esp/esp-idf/make/component_wrapper.mk:291: recipe for target 'flag_scoreboard.o' failed make[1]: *** [flag_scoreboard.o] Error 1 /home/user/esp/esp-idf/make/project.mk:635: recipe for target 'component-main-build' failed make: *** [component-main-build] Error 2
I wasn't sure if this was supposed to be a memory overflow puzzle... but to get the compilation to complete, I made a small change.
In line 191 of flag_scoreboard.c I changed string_total_flags to a 3-byte string by adding an additional nul character:
static char string_total_flags[] = "0\0\0";
There's a hint that the pending pull request resolved this?
Let's leave this memcpy issue in the code. It's not supposed to be there but maybe someone will have fun with it.