Skip to content

Commit

Permalink
Use snprintf in win_get_num_i
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbatalov committed Jan 13, 2025
1 parent bd7321b commit 3dbea2e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/window_manager_private.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1294,12 +1294,9 @@ int win_get_num_i(int* value, int min, int max, bool clear, const char* title, i
"Cancel",
0);

char* hint = (char*)internal_malloc(80);
if (hint == nullptr) {
return -1;
}
char hint[80];

sprintf(hint, "Please enter a number between %d and %d.", min, max);
snprintf(hint, sizeof(hint), "Please enter a number between %d and %d.", min, max);
windowRefresh(win);

int rc;
Expand All @@ -1317,7 +1314,6 @@ int win_get_num_i(int* value, int min, int max, bool clear, const char* title, i
*value = original;
}

internal_free(hint);
windowDestroy(win);

return rc;
Expand Down

0 comments on commit 3dbea2e

Please sign in to comment.