engine: client: more reliable way to find the payload the netinfo response
This commit is contained in:
parent
ab130ee92c
commit
e0dc1eec93
1 changed files with 36 additions and 13 deletions
|
@ -1868,6 +1868,7 @@ static void CL_ParseNETInfoMessage( netadr_t from, const char *s )
|
||||||
int i, context, type;
|
int i, context, type;
|
||||||
int errorBits = 0;
|
int errorBits = 0;
|
||||||
const char *val;
|
const char *val;
|
||||||
|
size_t slen;
|
||||||
|
|
||||||
context = Q_atoi( Cmd_Argv( 1 ));
|
context = Q_atoi( Cmd_Argv( 1 ));
|
||||||
type = Q_atoi( Cmd_Argv( 2 ));
|
type = Q_atoi( Cmd_Argv( 2 ));
|
||||||
|
@ -1886,10 +1887,23 @@ static void CL_ParseNETInfoMessage( netadr_t from, const char *s )
|
||||||
if( nr == NULL )
|
if( nr == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// find the infostring
|
// find the payload
|
||||||
while( *s != '\\' && *s )
|
s = Q_strchr( s, ' ' ); // skip netinfo
|
||||||
s++;
|
if( !s )
|
||||||
|
return;
|
||||||
|
|
||||||
|
s = Q_strchr( s + 1, ' ' ); // skip challenge
|
||||||
|
if( !s )
|
||||||
|
return;
|
||||||
|
|
||||||
|
s = Q_strchr( s + 1, ' ' ); // skip type
|
||||||
|
if( s )
|
||||||
|
s++; // skip final whitespace
|
||||||
|
else if( type != NETAPI_REQUEST_PING ) // ping have no payload, and that's ok
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( s )
|
||||||
|
{
|
||||||
if( s[0] == '\\' )
|
if( s[0] == '\\' )
|
||||||
{
|
{
|
||||||
// check for errors
|
// check for errors
|
||||||
|
@ -1904,6 +1918,15 @@ static void CL_ParseNETInfoMessage( netadr_t from, const char *s )
|
||||||
|
|
||||||
CL_FixupColorStringsForInfoString( s, infostring, sizeof( infostring ));
|
CL_FixupColorStringsForInfoString( s, infostring, sizeof( infostring ));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Q_strncpy( infostring, s, sizeof( infostring ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
infostring[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// setup the answer
|
// setup the answer
|
||||||
nr->resp.response = infostring;
|
nr->resp.response = infostring;
|
||||||
|
|
Loading…
Add table
Reference in a new issue