From: divverent Date: Wed, 4 Feb 2015 12:24:18 +0000 (+0000) Subject: Fix check order of keygen_i. X-Git-Tag: xonotic-v0.8.1~29^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=43347b56ebdea21e8467c568b1ef38178a7022f3;p=xonotic%2Fdarkplaces.git Fix check order of keygen_i. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12145 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/crypto.c b/crypto.c index 8f7deba7..ebb78d2e 100644 --- a/crypto.c +++ b/crypto.c @@ -1068,17 +1068,17 @@ static void Crypto_KeyGen_Finished(int code, size_t length_received, unsigned ch return; } - if(keygen_i >= MAX_PUBKEYS || !pubkeys[keygen_i]) + if(keygen_i < 0) { - Con_Printf("overflow of keygen_i\n"); - keygen_i = -1; + Con_Printf("Unexpected response from keygen server:\n"); + Com_HexDumpToConsole(buffer, (int)length_received); SV_UnlockThreadMutex(); return; } - if(keygen_i < 0) + if(keygen_i >= MAX_PUBKEYS || !pubkeys[keygen_i]) { - Con_Printf("Unexpected response from keygen server:\n"); - Com_HexDumpToConsole(buffer, (int)length_received); + Con_Printf("overflow of keygen_i\n"); + keygen_i = -1; SV_UnlockThreadMutex(); return; }