Fix potential overflow when reading very long Controller ID string
This commit is contained in:
parent
1f2a070c09
commit
5042b7bae4
1 changed files with 1 additions and 1 deletions
|
@ -296,7 +296,7 @@ static int init_joystick(void)
|
||||||
for (int cpt; cpt < nr_joysticks; cpt++)
|
for (int cpt; cpt < nr_joysticks; cpt++)
|
||||||
{
|
{
|
||||||
Joysticktable[cpt] = SDL_JoystickOpen(cpt);
|
Joysticktable[cpt] = SDL_JoystickOpen(cpt);
|
||||||
strncpy(JoystickName[cpt], SDL_JoystickName(cpt), 80);
|
strncpy(JoystickName[cpt], SDL_JoystickName(cpt), sizeof JoystickName[cpt]);
|
||||||
printf("Joystick %i : %s\n", cpt, JoystickName[cpt]);
|
printf("Joystick %i : %s\n", cpt, JoystickName[cpt]);
|
||||||
printf(" Buttons: %i Axis: %i Hats: %i\n", SDL_JoystickNumButtons(Joysticktable[cpt]), SDL_JoystickNumAxes(Joysticktable[cpt]), SDL_JoystickNumHats(Joysticktable[cpt]));
|
printf(" Buttons: %i Axis: %i Hats: %i\n", SDL_JoystickNumButtons(Joysticktable[cpt]), SDL_JoystickNumAxes(Joysticktable[cpt]), SDL_JoystickNumHats(Joysticktable[cpt]));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue