From: divverent Date: Wed, 11 Mar 2009 06:22:50 +0000 (+0000) Subject: [ 2680901 ] Fix server/client crashes X-Git-Tag: xonotic-v0.1.0preview~1806 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2d3dea2a4628779c5f2ec8255539d6dc207b88ff;p=xonotic%2Fdarkplaces.git [ 2680901 ] Fix server/client crashes git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8790 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/netconn.c b/netconn.c index 01d8181c..2a62f129 100755 --- a/netconn.c +++ b/netconn.c @@ -1455,7 +1455,7 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat char rejectreason[32]; cls.connect_trying = false; string += 7; - length = max(length - 7, (int)sizeof(rejectreason) - 1); + length = min(length - 7, (int)sizeof(rejectreason) - 1); memcpy(rejectreason, string, length); rejectreason[length] = 0; M_Update_Return_Reason(rejectreason); @@ -2309,7 +2309,7 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat return true; // check engine protocol - if (strcmp(SearchInfostring(string, "protocol"), "darkplaces 3")) + if(!(s = SearchInfostring(string, "protocol")) || strcmp(s, "darkplaces 3")) { if (developer.integer >= 10) Con_Printf("Datagram_ParseConnectionless: sending \"reject Wrong game protocol.\" to %s.\n", addressstring2);