Small snake game in C
Commit 6a59dbb390d7
tarball1 file changed+2-2
@@ -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);