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