jag

snake_c

public

Small snake game in C

Star0
Watch0

Commit 6a59dbb390d7

tarball

Jaglekon <58274093+Jaglekon@users.noreply.github.com>2026-04-02 17:37 UTC

1 file changed+2-2
score actually v3
Modified file: snake.c+2 additions−2 deletions
@@ -113,14 +113,14 @@ int main(int argc, char *args[]) {
113113
114114 uint8_t i;
115115 for (i = 0; i < SCORE_NUMBER; i++) {
116- fgets(score_input, SCORE_LEN, score_file);
116+ fgets(score_input, sizeof(score_input), score_file);
117117 if (score_input[0] != '\0') {
118118 uint8_t j;
119119 for(j = 0; score_input[j] != '\0'; j++) {
120120 if (score_input[j] == '\n')
121121 score_input[j] = ' ';
122122 }
123- strcpy(leader_board[i].name, score_input);
123+ strncpy(leader_board[i].name, score_input, SCORE_LEN);
124124 }
125125
126126 fgets(score_input, sizeof(score_input), score_file);