From 17c14e1fad6dc277a6e58e4f421d5c65e210d1fe Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 1 Apr 2014 20:56:33 -0400 Subject: setup: Eliminate use of sprintf(). Use M_snprintf() or M_StringJoin() instead where appropriate. This fixes #371. --- src/setup/txt_joybinput.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/setup/txt_joybinput.c') diff --git a/src/setup/txt_joybinput.c b/src/setup/txt_joybinput.c index ce466d50..4e41f3fd 100644 --- a/src/setup/txt_joybinput.c +++ b/src/setup/txt_joybinput.c @@ -125,9 +125,9 @@ static void TXT_JoystickInputSizeCalc(TXT_UNCAST_ARG(joystick_input)) joystick_input->widget.h = 1; } -static void GetJoystickButtonDescription(int button, char *buf) +static void GetJoystickButtonDescription(int button, char *buf, size_t buf_len) { - sprintf(buf, "BUTTON #%i", button + 1); + M_snprintf(buf, buf_len, "BUTTON #%i", button + 1); } static void TXT_JoystickInputDrawer(TXT_UNCAST_ARG(joystick_input)) @@ -142,7 +142,8 @@ static void TXT_JoystickInputDrawer(TXT_UNCAST_ARG(joystick_input)) } else { - GetJoystickButtonDescription(*joystick_input->variable, buf); + GetJoystickButtonDescription(*joystick_input->variable, + buf, sizeof(buf)); } TXT_SetWidgetBG(joystick_input); -- cgit v1.2.3