2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-22 09:56:22 +01:00

engine: fix A2S_GOLDSRC_INFO, it must always include Source Engine Query and a null terminator

This commit is contained in:
Alibek Omarov 2024-10-26 20:21:45 +03:00
parent fa1e92b127
commit 2656eb1aeb
6 changed files with 9 additions and 8 deletions

View File

@ -1916,7 +1916,7 @@ static void CL_QueryServer_f( void )
switch( proto )
{
case PROTO_GOLDSRC:
Netchan_OutOfBandPrint( NS_CLIENT, adr, "%cSource Engine Query", A2S_GOLDSRC_INFO );
Netchan_OutOfBand( NS_CLIENT, adr, sizeof( A2S_GOLDSRC_INFO ), A2S_GOLDSRC_INFO ); // includes null terminator!
break;
case PROTO_LEGACY:
Netchan_OutOfBandPrint( NS_CLIENT, adr, A2A_INFO" %i", PROTOCOL_LEGACY_VERSION );

View File

@ -520,7 +520,7 @@ Netchan_OutOfBand
Sends an out-of-band datagram
================
*/
void Netchan_OutOfBand( int net_socket, netadr_t adr, int len, byte *data )
void Netchan_OutOfBand( int net_socket, netadr_t adr, int len, const byte *data )
{
byte buf[MAX_PRINT_MSG + 4] = { 0xff, 0xff, 0xff, 0xff };

View File

@ -306,7 +306,7 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg );
void Netchan_CreateFragments( netchan_t *chan, sizebuf_t *msg );
int Netchan_CreateFileFragments( netchan_t *chan, const char *filename );
void Netchan_TransmitBits( netchan_t *chan, int lengthInBits, const byte *data );
void Netchan_OutOfBand( int net_socket, netadr_t adr, int length, byte *data );
void Netchan_OutOfBand( int net_socket, netadr_t adr, int length, const byte *data );
void Netchan_OutOfBandPrint( int net_socket, netadr_t adr, const char *format, ... ) _format( 3 );
qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg );
void Netchan_UpdateProgress( netchan_t *chan );

View File

@ -363,7 +363,7 @@ extern const char *const clc_strings[clc_lastmsg+1];
#define A2A_GOLDSRC_ACK "j" // no-op
// from any to server
#define A2S_GOLDSRC_INFO 'T'
#define A2S_GOLDSRC_INFO "TSource Engine Query"
#define A2S_GOLDSRC_RULES 'V'
#define A2S_GOLDSRC_PLAYERS 'U'

View File

@ -3176,7 +3176,7 @@ void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
return;
}
if( pcmd[0] == A2S_GOLDSRC_INFO || pcmd[0] == A2S_GOLDSRC_PLAYERS || pcmd[0] == A2S_GOLDSRC_RULES )
if( !Q_strcmp( pcmd, A2S_GOLDSRC_INFO ) || pcmd[0] == A2S_GOLDSRC_PLAYERS || pcmd[0] == A2S_GOLDSRC_RULES )
{
SV_SourceQuery_HandleConnnectionlessPacket( pcmd, from );
}

View File

@ -173,11 +173,12 @@ SV_SourceQuery_HandleConnnectionlessPacket
*/
void SV_SourceQuery_HandleConnnectionlessPacket( const char *c, netadr_t from )
{
switch( c[0] )
if( !Q_strcmp( c, A2S_GOLDSRC_INFO ))
{
case A2S_GOLDSRC_INFO:
SV_SourceQuery_Details( from );
break;
}
else switch( c[0] )
{
case A2S_GOLDSRC_RULES:
SV_SourceQuery_Rules( from );
break;