diff --git a/public/crtlib.c b/public/crtlib.c index 8e087bac..e9321f9a 100644 --- a/public/crtlib.c +++ b/public/crtlib.c @@ -995,7 +995,7 @@ COM_ParseFile text parser ============== */ -const char *_COM_ParseFileSafe( const char *data, char *token, const int size, unsigned int flags, int *plen ) +char *_COM_ParseFileSafe( char *data, char *token, const int size, unsigned int flags, int *plen ) { int c, len = 0; qboolean overflow = false; @@ -1054,6 +1054,7 @@ skipwhite: token[len] = (byte)*data; len++; } + else overflow = true; data++; continue; @@ -1071,6 +1072,7 @@ skipwhite: token[len] = c; len++; } + else overflow = true; } } @@ -1102,6 +1104,7 @@ skipwhite: token[len] = c; len++; } + else overflow = true; data++; c = ((byte)*data); diff --git a/public/crtlib.h b/public/crtlib.h index ad1d7cc0..2e676f53 100644 --- a/public/crtlib.h +++ b/public/crtlib.h @@ -95,7 +95,7 @@ char COM_Hex2Char( uint8_t hex ); void COM_Hex2String( uint8_t hex, char *str ); #define COM_CheckString( string ) ( ( !string || !*string ) ? 0 : 1 ) #define COM_CheckStringEmpty( string ) ( ( !*string ) ? 0 : 1 ) -const char *_COM_ParseFileSafe( const 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_ParseFileLegacy( data, token ) COM_ParseFileSafe( data, token, INT_MAX ) int matchpattern( const char *in, const char *pattern, qboolean caseinsensitive );