diff options
author | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2009-10-19 22:36:17 +0000 |
---|---|---|
committer | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2009-10-19 22:36:17 +0000 |
commit | 473debef0e5c4229d9fdd5a7418e6e9bd7cdd51c (patch) | |
tree | 5cbbbffd84c6dab9b223b6e16cff1f4a6168435c /code/client/cl_main.c | |
parent | 54af38d7f47e4135aab626496e2de9e71dd49cff (diff) | |
download | ioquake3-aero-473debef0e5c4229d9fdd5a7418e6e9bd7cdd51c.tar.gz ioquake3-aero-473debef0e5c4229d9fdd5a7418e6e9bd7cdd51c.zip |
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
Diffstat (limited to 'code/client/cl_main.c')
-rw-r--r-- | code/client/cl_main.c | 20 |
1 files changed, 19 insertions, 1 deletions
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; } |