diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index 730939502..805eb5e2f 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 */