Fix buffer overflow (space for '\0' character missing)
This commit is contained in:
@@ -176,7 +176,7 @@ void initAlphabet(game_state *gs) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gs->alphabet = malloc(sizeof(char) * hasNumber ? ALPHABET : ALPHABET_NUM);
|
gs->alphabet = malloc(sizeof(char) * ((hasNumber ? ALPHABET : ALPHABET_NUM) + 1));
|
||||||
strcpy(gs->alphabet, "abcdefghijklmnopqrstuvwxyz");
|
strcpy(gs->alphabet, "abcdefghijklmnopqrstuvwxyz");
|
||||||
|
|
||||||
if (hasNumber) {
|
if (hasNumber) {
|
||||||
|
Reference in New Issue
Block a user