r1316 - trunk/code/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Apr 12 15:53:16 EDT 2008


Author: thilo
Date: 2008-04-12 15:53:16 -0400 (Sat, 12 Apr 2008)
New Revision: 1316

Modified:
   trunk/code/client/cl_main.c
Log:
Another change to server parsing as a server reporting in from 69.79.84.0/24 with the master server could screw up the server list in ioquake3 clients.


Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2008-04-12 18:58:06 UTC (rev 1315)
+++ trunk/code/client/cl_main.c	2008-04-12 19:53:16 UTC (rev 1316)
@@ -1843,7 +1843,6 @@
 	int				numservers;
 	byte*			buffptr;
 	byte*			buffend;
-	netadrtype_t		family = NA_IP;
 	
 	Com_Printf("CL_ServersResponsePacket\n");
 
@@ -1857,47 +1856,43 @@
 	numservers = 0;
 	buffptr    = msg->data;
 	buffend    = buffptr + msg->cursize;
-	while (buffptr+1 < buffend)
+
+	// advance to initial token
+	do
 	{
-		// advance to initial token
-		do
+		if(*buffptr == '\\' || *buffptr == '/')
+			break;
+		
+		buffptr++;
+	} while (buffptr < buffend);
+
+	while (buffptr + 1 < buffend)
+	{
+		if (*buffptr == '\\')
 		{
-			if (*buffptr == '\\')
-			{
-				family = NA_IP;
-				break;
-			}
-			else if(*buffptr == '/')
-			{
-				family = NA_IP6;
-				break;
-			}
-			
 			buffptr++;
-		}
-		while (buffptr < buffend);
 
-		buffptr++;
-		
-		if(family == NA_IP)
-		{
-			if (buffend - buffptr < sizeof(addresses[numservers].ip) + sizeof(addresses[numservers].port) + sizeof("\\EOT") - 1)
+			if (buffend - buffptr < sizeof(addresses[numservers].ip) + sizeof(addresses[numservers].port) + 1)
 				break;
-			
+
 			for(i = 0; i < sizeof(addresses[numservers].ip); i++)
 				addresses[numservers].ip[i] = *buffptr++;
+
+			addresses[numservers].type = NA_IP;
 		}
 		else
 		{
-			if (buffend - buffptr < sizeof(addresses[numservers].ip6) + sizeof(addresses[numservers].port) + sizeof("\\EOT") - 1)
+			buffptr++;
+
+			if (buffend - buffptr < sizeof(addresses[numservers].ip6) + sizeof(addresses[numservers].port) + 1)
 				break;
 			
 			for(i = 0; i < sizeof(addresses[numservers].ip6); i++)
 				addresses[numservers].ip6[i] = *buffptr++;
+			
+			addresses[numservers].type = NA_IP6;
 		}
-
-		addresses[numservers].type = family;
-
+			
 		// parse out port
 		addresses[numservers].port = (*buffptr++) << 8;
 		addresses[numservers].port += *buffptr++;
@@ -1912,8 +1907,9 @@
 			break;
 
 		// parse out EOT
-		if (buffptr[1] == 'E' && buffptr[2] == 'O' && buffptr[3] == 'T')
-			break;
+		// not anymore.. as servers from 69.79.84.0/24 can screw up the server list with this.
+//		if (buffptr[1] == 'E' && buffptr[2] == 'O' && buffptr[3] == 'T')
+//			break;
 	}
 
 	count = cls.numglobalservers;




More information about the quake3-commits mailing list