Skip to content

Commit

Permalink
console: Use isprint() instead of magic constants to filter console i…
Browse files Browse the repository at this point in the history
…nput
  • Loading branch information
mrannanj authored and katajakasa committed Jul 3, 2024
1 parent 8e8609a commit 90a1a55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/console/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void console_event(game_state *gs, SDL_Event *e) {
// make sure it is not a unicode sequence
unsigned char c = e->text.text[0];
// only allow ASCII through
if(c >= 32 && c <= 126 && len < sizeof(con->input) - 1) {
if(isprint(c) && len < sizeof(con->input) - 1) {
con->input[len + 1] = '\0';
con->input[len] = tolower(c);
}
Expand Down

0 comments on commit 90a1a55

Please sign in to comment.