From 4ba95277b97bf601d8fb5b4b9c8f7bde01b616fd Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 1 Oct 2021 20:12:31 +0300 Subject: [PATCH] engine: client: fix ParseFile calls --- engine/client/cl_efx.c | 20 ++++++++++---------- engine/client/cl_game.c | 20 ++++++++++---------- engine/client/cl_gameui.c | 2 +- engine/client/cl_parse.c | 2 +- engine/client/cl_video.c | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/engine/client/cl_efx.c b/engine/client/cl_efx.c index df02c7ce..9db01f93 100644 --- a/engine/client/cl_efx.c +++ b/engine/client/cl_efx.c @@ -513,19 +513,19 @@ void CL_ReadLineFile_f( void ) while( 1 ) { - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); if( !pfile ) break; p1[0] = Q_atof( token ); - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); if( !pfile ) break; p1[1] = Q_atof( token ); - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); if( !pfile ) break; p1[2] = Q_atof( token ); - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); if( !pfile ) break; if( token[0] != '-' ) @@ -534,15 +534,15 @@ void CL_ReadLineFile_f( void ) break; } - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); if( !pfile ) break; p2[0] = Q_atof( token ); - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); if( !pfile ) break; p2[1] = Q_atof( token ); - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); if( !pfile ) break; p2[2] = Q_atof( token ); @@ -2020,15 +2020,15 @@ void CL_ReadPointFile_f( void ) while( 1 ) { - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); if( !pfile ) break; org[0] = Q_atof( token ); - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); if( !pfile ) break; org[1] = Q_atof( token ); - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); if( !pfile ) break; org[2] = Q_atof( token ); diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 88df0d1f..259a5bc1 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -234,7 +234,7 @@ void CL_InitCDAudio( const char *filename ) pfile = (char *)afile; // format: trackname\n [num] - while(( pfile = COM_ParseFile( pfile, token )) != NULL ) + while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL ) { if( !Q_stricmp( token, "blank" )) token[0] = '\0'; Q_strncpy( clgame.cdtracks[c], token, sizeof( clgame.cdtracks[0] )); @@ -1535,7 +1535,7 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount ) if( !afile ) return NULL; pfile = (char *)afile; - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); numSprites = Q_atoi( token ); Q_strncpy( pEntry->szListName, psz, sizeof( pEntry->szListName )); @@ -1545,30 +1545,30 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount ) for( index = 0; index < numSprites; index++ ) { - if(( pfile = COM_ParseFile( pfile, token )) == NULL ) + if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL ) break; Q_strncpy( pEntry->pList[index].szName, token, sizeof( pEntry->pList[0].szName )); // read resolution - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); pEntry->pList[index].iRes = Q_atoi( token ); // read spritename - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); Q_strncpy( pEntry->pList[index].szSprite, token, sizeof( pEntry->pList[0].szSprite )); // parse rectangle - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); pEntry->pList[index].rc.left = Q_atoi( token ); - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); pEntry->pList[index].rc.top = Q_atoi( token ); - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); pEntry->pList[index].rc.right = pEntry->pList[index].rc.left + Q_atoi( token ); - pfile = COM_ParseFile( pfile, token ); + pfile = COM_ParseFile( pfile, token, sizeof( token )); pEntry->pList[index].rc.bottom = pEntry->pList[index].rc.top + Q_atoi( token ); pEntry->count++; @@ -3078,7 +3078,7 @@ char *pfnParseFile( char *data, char *token ) { char *out; - out = _COM_ParseFileSafe( data, token, -1, PFILE_HANDLECOLON, NULL ); + out = _COM_ParseFileSafe( data, token, INT_MAX, PFILE_HANDLECOLON, NULL ); return out; } diff --git a/engine/client/cl_gameui.c b/engine/client/cl_gameui.c index 87f9adf0..ad1ca07f 100644 --- a/engine/client/cl_gameui.c +++ b/engine/client/cl_gameui.c @@ -1115,7 +1115,7 @@ legacy wrapper */ static char *pfnParseFile( char *buf, char *token ) { - return COM_ParseFile( buf, token ); + return COM_ParseFile( buf, token, INT_MAX ); } // engine callbacks diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 6294f91b..917da93c 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -1743,7 +1743,7 @@ void CL_ParseResLocation( sizebuf_t *msg ) return; } - while( ( data = COM_ParseFile( data, token ) ) ) + while( ( data = COM_ParseFile( data, token, sizeof( token ) ) ) ) { Con_Reportf( "Adding %s as download location\n", token ); diff --git a/engine/client/cl_video.c b/engine/client/cl_video.c index 7884871e..1b4ad6e5 100644 --- a/engine/client/cl_video.c +++ b/engine/client/cl_video.c @@ -104,7 +104,7 @@ void SCR_CheckStartupVids( void ) pfile = (char *)afile; - while(( pfile = COM_ParseFile( pfile, token )) != NULL ) + while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL ) { Q_strncpy( cls.movies[c], token, sizeof( cls.movies[0] ));