]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
[ 2680901 ] Fix server/client crashes
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 11 Mar 2009 06:22:50 +0000 (06:22 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 11 Mar 2009 06:22:50 +0000 (06:22 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8790 d7cf8633-e32d-0410-b094-e92efae38249

netconn.c

index 01d8181c888e9239978b90f5f08025674b0e600e..2a62f12953a3011339a1872b767271694a2f1d04 100755 (executable)
--- 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);