Forbid download not precached files

This commit is contained in:
mittorn 2018-05-05 00:01:32 +07:00
parent 6ae44d7577
commit 30771fefa6
1 changed files with 20 additions and 0 deletions

View File

@ -1831,6 +1831,26 @@ static qboolean SV_DownloadFile_f( sv_client_t *cl )
{
if( sv_send_resources.value )
{
int i;
// security: allow download only precached resources
for( i = 0; i < sv.num_resources; i++ )
{
const char *cmpname = name;
if( sv.resources[i].type == t_sound )
cmpname += sizeof( DEFAULT_SOUNDPATH ); // cut "sound/" off
if( !Q_strncmp( sv.resources[i].szFileName, cmpname, 64 ) )
break;
}
if( i == sv.num_resources )
{
SV_FailDownload( cl, name );
return true;
}
// also check the model textures
if( !Q_stricmp( COM_FileExtension( name ), "mdl" ))
{