From 473debef0e5c4229d9fdd5a7418e6e9bd7cdd51c Mon Sep 17 00:00:00 2001 From: thilo Date: Mon, 19 Oct 2009 22:36:17 +0000 Subject: Fix infinite loop in case an invalid pk3 file has been downloaded from the server. Thanks tjw for reporting (#3074) git-svn-id: svn://svn.icculus.org/quake3/trunk@1686 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/client/cl_main.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'code/client/cl_main.c') diff --git a/code/client/cl_main.c b/code/client/cl_main.c index f435be0..029dba4 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -1916,11 +1916,25 @@ CL_NextDownload A download completed or failed ================= */ -void CL_NextDownload(void) { +void CL_NextDownload(void) +{ char *s; char *remoteName, *localName; qboolean useCURL = qfalse; + // A download has finished, check whether this matches a referenced checksum + if(*clc.downloadName) + { + char *zippath = FS_BuildOSPath(Cvar_VariableString("fs_homepath"), clc.downloadName, ""); + zippath[strlen(zippath)-1] = '\0'; + + if(!FS_CompareZipChecksum(zippath)) + Com_Error(ERR_DROP, "Incorrect checksum for file: %s", clc.downloadName); + } + + *clc.downloadTempName = *clc.downloadName = 0; + Cvar_Set("cl_downloadName", ""); + // We are looking to start a download here if (*clc.downloadList) { s = clc.downloadList; @@ -2027,6 +2041,10 @@ void CL_InitDownloads(void) { if ( *clc.downloadList ) { // if autodownloading is not enabled on the server cls.state = CA_CONNECTED; + + *clc.downloadTempName = *clc.downloadName = 0; + Cvar_Set( "cl_downloadName", "" ); + CL_NextDownload(); return; } -- cgit v1.2.3