mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: validate paths before downloading
This commit is contained in:
@@ -18,7 +18,6 @@ GNU General Public License for more details.
|
|||||||
#include "client.h" // ConnectionProgress
|
#include "client.h" // ConnectionProgress
|
||||||
#include "netchan.h"
|
#include "netchan.h"
|
||||||
#include "xash3d_mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "ipv6text.h"
|
|
||||||
#include "net_ws_private.h"
|
#include "net_ws_private.h"
|
||||||
#include "miniz.h"
|
#include "miniz.h"
|
||||||
|
|
||||||
@@ -943,6 +942,12 @@ void HTTP_AddDownload( const char *path, int size, qboolean process, resource_t
|
|||||||
{
|
{
|
||||||
httpfile_t *httpfile;
|
httpfile_t *httpfile;
|
||||||
|
|
||||||
|
if( COM_CheckNastyPath( path ))
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "%s: refused to download %s, nasty path\n", __func__, path );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( !http.first_server )
|
if( !http.first_server )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "no servers to download %s\n", path );
|
Con_Printf( S_ERROR "no servers to download %s\n", path );
|
||||||
|
|||||||
@@ -1233,7 +1233,7 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
|
|||||||
Netchan_FlushIncoming( chan, FRAG_FILE_STREAM );
|
Netchan_FlushIncoming( chan, FRAG_FILE_STREAM );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if( filename[0] != '!' && !COM_IsSafeFileToDownload( filename ))
|
else if( filename[0] != '!' && ( COM_CheckNastyPath( filename ) || !COM_IsSafeFileToDownload( filename )))
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "file fragment received with bad path, ignoring\n" );
|
Con_Printf( S_ERROR "file fragment received with bad path, ignoring\n" );
|
||||||
Netchan_FlushIncoming( chan, FRAG_FILE_STREAM );
|
Netchan_FlushIncoming( chan, FRAG_FILE_STREAM );
|
||||||
|
|||||||
Reference in New Issue
Block a user