From cd3e202fca3e18ecd0bdecd295007ea97914e6ff Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Thu, 27 Jan 2011 17:07:07 +0000 Subject: [PATCH] - Add parameter checking to CL_*Ping* functions. - Remove unused CL_UpdateServerInfo function --- code/client/cl_main.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 0c9d9e4f..112d61de 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -3783,9 +3783,9 @@ void CL_GetPing( int n, char *buf, int buflen, int *pingtime ) int time; int maxPing; - if (!cl_pinglist[n].adr.port) + if (n < 0 || n >= MAX_PINGREQUESTS || !cl_pinglist[n].adr.port) { - // empty slot + // empty or invalid slot buf[0] = '\0'; *pingtime = 0; return; @@ -3815,21 +3815,6 @@ void CL_GetPing( int n, char *buf, int buflen, int *pingtime ) *pingtime = time; } -/* -================== -CL_UpdateServerInfo -================== -*/ -void CL_UpdateServerInfo( int n ) -{ - if (!cl_pinglist[n].adr.port) - { - return; - } - - CL_SetServerInfoByAddress(cl_pinglist[n].adr, cl_pinglist[n].info, cl_pinglist[n].time ); -} - /* ================== CL_GetPingInfo @@ -3837,9 +3822,9 @@ CL_GetPingInfo */ void CL_GetPingInfo( int n, char *buf, int buflen ) { - if (!cl_pinglist[n].adr.port) + if (n < 0 || n >= MAX_PINGREQUESTS || !cl_pinglist[n].adr.port) { - // empty slot + // empty or invalid slot if (buflen) buf[0] = '\0'; return;