Skip to content

Commit

Permalink
Writing the unsupported message at an offset to avoid overwriting the…
Browse files Browse the repository at this point in the history
… entire buffer.
  • Loading branch information
toadkarter committed Sep 26, 2023
1 parent 2f96322 commit c2111b6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cheevos/cheevos.c
Original file line number Diff line number Diff line change
Expand Up @@ -1764,17 +1764,17 @@ static void rcheevos_show_game_placard(void)
number_of_unsupported);

if (settings->bools.cheevos_start_active)
snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED),
number_of_core);
_len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED),
number_of_core);
else
snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED),
number_of_core - number_of_active - number_of_unsupported,
number_of_core);
_len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED),
number_of_core - number_of_active - number_of_unsupported,
number_of_core);

_len = snprintf(msg, sizeof(msg),
"%s (%s)", msg, number_of_unsupported_msg);
_len += snprintf(msg + _len, sizeof(msg) - _len,
" (%s)", number_of_unsupported_msg);

if (_len < 0)
return;
Expand Down

0 comments on commit c2111b6

Please sign in to comment.