Fix to buffer overrun in SDL_JoystickGetGUIDString().
authorJørgen P. Tjernø <jorgen@valvesoftware.com>
Thu, 05 Sep 2013 15:49:57 -0700
changeset 77319cbe58c01e31
parent 7730 e928464b98ec
child 7732 4c0e4274c3f8
Fix to buffer overrun in SDL_JoystickGetGUIDString().
src/joystick/SDL_joystick.c
     1.1 --- a/src/joystick/SDL_joystick.c	Thu Sep 05 07:15:26 2013 -0700
     1.2 +++ b/src/joystick/SDL_joystick.c	Thu Sep 05 15:49:57 2013 -0700
     1.3 @@ -776,7 +776,7 @@
     1.4          return;
     1.5      }
     1.6  
     1.7 -    for ( i = 0; i < sizeof(guid.data) && i < (cbGUID-1); i++ )
     1.8 +    for ( i = 0; i < sizeof(guid.data) && i < (cbGUID-1)/2; i++ )
     1.9      {
    1.10          /* each input byte writes 2 ascii chars, and might write a null byte. */
    1.11          /* If we don't have room for next input byte, stop */