Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23953/src
Modified Files:
cowmain.c parsemeta.c
Log Message:
Add sanity check on server status in metarefresh() so it doesn't fall out of bounds.
Index: cowmain.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cowmain.c 29 Nov 2006 12:06:34 -0000 1.17
+++ cowmain.c 1 Dec 2006 00:43:11 -0000 1.18
@@ -656,7 +656,7 @@
parsemeta(metaType);
}
#endif
-
+
fed_ship_bmp = "bitmaps/shiplib/fedship.bmp";
if ((stringDefault ("fedshipbmpfile")) != NULL)
fed_ship_bmp = stringDefault ("fedshipbmpfile");
Index: parsemeta.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/parsemeta.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- parsemeta.c 30 Nov 2006 01:25:05 -0000 1.17
+++ parsemeta.c 1 Dec 2006 00:43:11 -0000 1.18
@@ -839,7 +839,7 @@
FILE *cache;
char *cacheName;
char cacheFileName[PATH_MAX];
- int i;
+ int i, j;
cacheName = stringDefault("metaUDPCache");
@@ -877,8 +877,6 @@
/* hunt and kill old server lines from cache */
for(i=0;i<num_servers;i++)
{
- int j;
-
/* mark each server as needing to be refreshed */
serverlist[i].refresh = 1;
@@ -1232,6 +1230,10 @@
}
#endif
+ /* Ensure status field not out of bounds */
+ if (sp->status < statusOpen || sp->status > statusConnecting)
+ sp->status = statusNull;
+
sprintf(buf + strlen (buf), "%14s ", statusStrings[sp->status]);
if (sp->status == statusConnecting) color = W_Yellow;