From e5c091c3034cdc0174b932f65c61644f5164572e Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 17 May 2026 11:17:42 +0500 Subject: [PATCH] engine: client: fix off-by-one error in CL_ParseResource --- engine/client/parse/cl_parse.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/client/parse/cl_parse.c b/engine/client/parse/cl_parse.c index 373789c7..90086f9d 100644 --- a/engine/client/parse/cl_parse.c +++ b/engine/client/parse/cl_parse.c @@ -1465,31 +1465,31 @@ void CL_ParseResource( sizebuf_t *msg ) if( MSG_ReadOneBit( msg )) MSG_ReadBytes( msg, pResource->rguc_reserved, sizeof( pResource->rguc_reserved )); - if( pResource->type == t_sound && pResource->nIndex > MAX_SOUNDS ) + if( pResource->type == t_sound && pResource->nIndex >= MAX_SOUNDS ) { Mem_Free( pResource ); Host_Error( "bad sound index\n" ); } - if( pResource->type == t_model && pResource->nIndex > MAX_MODELS ) + if( pResource->type == t_model && pResource->nIndex >= MAX_MODELS ) { Mem_Free( pResource ); Host_Error( "bad model index\n" ); } - if( pResource->type == t_eventscript && pResource->nIndex > MAX_EVENTS ) + if( pResource->type == t_eventscript && pResource->nIndex >= MAX_EVENTS ) { Mem_Free( pResource ); Host_Error( "bad event index\n" ); } - if( pResource->type == t_generic && pResource->nIndex > MAX_CUSTOM ) + if( pResource->type == t_generic && pResource->nIndex >= MAX_CUSTOM ) { Mem_Free( pResource ); Host_Error( "bad file index\n" ); } - if( pResource->type == t_decal && pResource->nIndex > MAX_DECALS ) + if( pResource->type == t_decal && pResource->nIndex >= MAX_DECALS ) { Mem_Free( pResource ); Host_Error( "bad decal index\n" );