Bugfix: Correct handling of n in strncat()

This commit is contained in:
Andreas Eversberg
2019-09-28 15:49:04 +02:00
parent 830794bae4
commit 860f91af6f
2 changed files with 3 additions and 3 deletions

View File

@@ -144,7 +144,7 @@ void set_speech_string(jolly_t *jolly, char announcement, const char *number)
{
jolly->speech_string[0] = announcement;
jolly->speech_string[1] = '\0';
strncat(jolly->speech_string, number, sizeof(jolly->speech_string) - 1);
strncat(jolly->speech_string, number, sizeof(jolly->speech_string) - strlen(number) - 1);
jolly->speech_digit = 0;
jolly->speech_pos = 0;
}