Skip to content

Commit

Permalink
Modify sprintf with snprintf to prevent undefined behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
damien committed Jul 29, 2024
1 parent be5adef commit 191194d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/calc.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static int _apps_calc_button_to_id(apps_calc_t *calc, twin_button_t *button)
static void _apps_calc_update_value(apps_calc_t *calc)
{
char v[20];

snprintf(v, sizeof(v) + 1, "%d", calc->stack[0]);
twin_label_set(calc->display, v, APPS_CALC_VALUE_FG, APPS_CALC_VALUE_SIZE,
APPS_CALC_VALUE_STYLE);
Expand Down

0 comments on commit 191194d

Please sign in to comment.