Change shift expressions to unsigned types. Shifting signed values to

a result that is not representable has undefined behaviour.
This commit is contained in:
Thomas Köppe authored and Zack Middleton committed 2018-01-21 06:01:50 -06:00
1 parent 7e2aa2c627
commit ed1794fe17
6 files changed
+11 -8

No files matched your search

+2 -2
View File
@@ -1539,7 +1539,7 @@ void CL_RequestMotd( void ) {
info[0] = 0;
Com_sprintf( cls.updateChallenge, sizeof( cls.updateChallenge ), "%i", ((rand() << 16) ^ rand()) ^ Com_Milliseconds());
Com_sprintf( cls.updateChallenge, sizeof( cls.updateChallenge ), "%i", (int)((((unsigned int)rand() << 16) ^ (unsigned int)rand()) ^ Com_Milliseconds()));
Info_SetValueForKey( info, "challenge", cls.updateChallenge );
Info_SetValueForKey( info, "renderer", cls.glconfig.renderer_string );
@@ -1768,7 +1768,7 @@ void CL_Connect_f( void ) {
clc.state = CA_CONNECTING;
// Set a client challenge number that ideally is mirrored back by the server.
clc.challenge = ((rand() << 16) ^ rand()) ^ Com_Milliseconds();
clc.challenge = (((unsigned int)rand() << 16) ^ (unsigned int)rand()) ^ Com_Milliseconds();
}
Key_SetCatcher( 0 );