Commit f06eeb013b6371097dcc3bb41b1f80813e0cee23

J?rgen P. Tjern? 2013-09-05T15:49:57

Fix to buffer overrun in SDL_JoystickGetGUIDString().

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 7309395..805eb5e 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -776,7 +776,7 @@ void SDL_JoystickGetGUIDString( SDL_JoystickGUID guid, char *pszGUID, int cbGUID
         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 */