Fix to buffer overrun in SDL_JoystickGetGUIDString().

This commit is contained in:
J?rgen P. Tjern? 2013-09-05 15:49:57 -07:00
parent 4b942c5a07
commit f06eeb013b

View File

@ -776,7 +776,7 @@ void SDL_JoystickGetGUIDString( SDL_JoystickGUID guid, char *pszGUID, int cbGUID
return; 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. */ /* each input byte writes 2 ascii chars, and might write a null byte. */
/* If we don't have room for next input byte, stop */ /* If we don't have room for next input byte, stop */