Browse Source

engine: client: limit token size in client dll parsefile to 1024 (GoldSrc value)

pull/2/head
Alibek Omarov 3 years ago
parent
commit
56103a90eb
  1. 2
      engine/client/cl_game.c
  2. 2
      public/crtlib.h

2
engine/client/cl_game.c

@ -3089,7 +3089,7 @@ char *pfnParseFile( char *data, char *token )
{ {
char *out; char *out;
out = _COM_ParseFileSafe( data, token, INT_MAX, PFILE_HANDLECOLON, NULL ); out = _COM_ParseFileSafe( data, token, PFILE_TOKEN_MAX_LENGTH, PFILE_HANDLECOLON, NULL );
return out; return out;
} }

2
public/crtlib.h

@ -43,6 +43,7 @@ enum
// exported APIs headers and will get nice warning in case of changing values // exported APIs headers and will get nice warning in case of changing values
#define PFILE_IGNOREBRACKET (1<<0) #define PFILE_IGNOREBRACKET (1<<0)
#define PFILE_HANDLECOLON (1<<1) #define PFILE_HANDLECOLON (1<<1)
#define PFILE_TOKEN_MAX_LENGTH 1024
// //
// crtlib.c // crtlib.c
@ -98,7 +99,6 @@ void COM_Hex2String( uint8_t hex, char *str );
#define COM_CheckStringEmpty( string ) ( ( !*string ) ? 0 : 1 ) #define COM_CheckStringEmpty( string ) ( ( !*string ) ? 0 : 1 )
char *_COM_ParseFileSafe( char *data, char *token, const int size, unsigned int flags, int *len ); char *_COM_ParseFileSafe( char *data, char *token, const int size, unsigned int flags, int *len );
#define COM_ParseFile( data, token, size ) _COM_ParseFileSafe( data, token, size, 0, NULL ) #define COM_ParseFile( data, token, size ) _COM_ParseFileSafe( data, token, size, 0, NULL )
#define COM_ParseFileLegacy( data, token ) COM_ParseFileSafe( data, token, INT_MAX )
int matchpattern( const char *in, const char *pattern, qboolean caseinsensitive ); int matchpattern( const char *in, const char *pattern, qboolean caseinsensitive );
int matchpattern_with_separator( const char *in, const char *pattern, qboolean caseinsensitive, const char *separators, qboolean wildcard_least_one ); int matchpattern_with_separator( const char *in, const char *pattern, qboolean caseinsensitive, const char *separators, qboolean wildcard_least_one );

Loading…
Cancel
Save