Skip to content

Commit

Permalink
Replace potentially unsafe sprintf with q_snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler committed Nov 19, 2023
1 parent 2af4e57 commit 20a40e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Quake/keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ void Key_Event (int key, qboolean down)
kb = keybindings[key];
if (kb && kb[0] == '+')
{
sprintf (cmd, "-%s %i\n", kb+1, key);
q_snprintf (cmd, sizeof (cmd), "-%s %i\n", kb+1, key);
Cbuf_AddText (cmd);
}
if (key_dest == key_console && key == K_MOUSE1)
Expand All @@ -1163,7 +1163,7 @@ void Key_Event (int key, qboolean down)
{
if (kb[0] == '+')
{ // button commands add keynum as a parm
sprintf (cmd, "%s %i\n", kb, key);
q_snprintf (cmd, sizeof (cmd), "%s %i\n", kb, key);
Cbuf_AddText (cmd);
}
else
Expand Down

0 comments on commit 20a40e1

Please sign in to comment.