Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WhackJack unitialized structure leads to POLL failure #72

Open
icemonster opened this issue Apr 13, 2020 · 1 comment
Open

WhackJack unitialized structure leads to POLL failure #72

icemonster opened this issue Apr 13, 2020 · 1 comment

Comments

@icemonster
Copy link

Hello.

In the WhackJack challenge, in the service.c file we can see it is declared a
playerInfoType players[MAX_PLAYERS] but this vector (and consequently the player_name attribute of each player) is not initialized.

The cgc_show_players function in player.c assumes it is. When a user inputs 4 in the main menu to ask for the statistics, some of the players may be printed because the first byte of their player_name string is not '\0'. This behavior is not predicted by the POLL state machine.

This leads to a POL failure in my system. The fix is easy:
playerInfoType players[MAX_PLAYERS] = {0}; and I think it won't affect the intended vulnerabilities.

I didn't make a pull request because I don't know if assuming that the memory is always initialized to zero is an assumption here and maybe I'll have this same problem in other challenges too... Please let me know if that's the case.

@icemonster
Copy link
Author

icemonster commented Apr 13, 2020

This is a bit weird since global variables should always be initialized to zero...
EDIT: Now that I had a good night sleep I realize that the players variable is inside main, it just doesn't look like it due to the identation. It really should be initialized then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant