Fix infinite loop in case an invalid pk3 file has been downloaded from the server. Thanks tjw for reporting (#3074)

This commit is contained in:
Thilo Schulz 2009-10-19 22:36:17 +00:00
parent d93cc3c997
commit fd57c987c4
5 changed files with 78 additions and 20 deletions

View file

@ -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;
}