engine: client: allow reading upper directories for clc_fileconsistency. Initialize md5 digest, add note about servers relying on uninitialized md5 value in some cases.

This commit is contained in:
Alibek Omarov 2024-10-26 05:17:24 +03:00
parent 49990a0859
commit 667bedab82

View file

@ -1617,7 +1617,7 @@ static void CL_SendConsistencyInfo( sizebuf_t *msg, connprotocol_t proto )
vec3_t mins, maxs; vec3_t mins, maxs;
string filename; string filename;
CRC32_t crcFile; CRC32_t crcFile;
byte md5[16]; byte md5[16] = { 0 };
consistency_t *pc; consistency_t *pc;
int i, pos; int i, pos;
@ -1633,6 +1633,8 @@ static void CL_SendConsistencyInfo( sizebuf_t *msg, connprotocol_t proto )
MSG_StartBitWriting( msg ); MSG_StartBitWriting( msg );
} }
FS_AllowDirectPaths( true );
for( i = 0; i < cl.num_consistency; i++ ) for( i = 0; i < cl.num_consistency; i++ )
{ {
qboolean have_file = true; qboolean have_file = true;
@ -1661,6 +1663,8 @@ static void CL_SendConsistencyInfo( sizebuf_t *msg, connprotocol_t proto )
switch( pc->check_type ) switch( pc->check_type )
{ {
case force_exactfile: case force_exactfile:
// servers rely on md5 not being initialized after previous file
// if current file doesn't exist
MD5_HashFile( md5, filename, NULL ); MD5_HashFile( md5, filename, NULL );
memcpy( &pc->value, md5, sizeof( pc->value )); memcpy( &pc->value, md5, sizeof( pc->value ));
LittleLongSW( pc->value ); LittleLongSW( pc->value );
@ -1709,6 +1713,8 @@ static void CL_SendConsistencyInfo( sizebuf_t *msg, connprotocol_t proto )
} }
} }
FS_AllowDirectPaths( false );
MSG_WriteOneBit( msg, 0 ); MSG_WriteOneBit( msg, 0 );
if( proto == PROTO_GOLDSRC ) if( proto == PROTO_GOLDSRC )