From ac40badaa5fc33b7661c712e5684bb7d31fe9be6 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 25 May 2022 03:36:23 +0300 Subject: [PATCH] engine: client: fix array overruns --- engine/client/cl_events.c | 4 ++-- engine/client/cl_frame.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/client/cl_events.c b/engine/client/cl_events.c index bcf3f76d..0107a65e 100644 --- a/engine/client/cl_events.c +++ b/engine/client/cl_events.c @@ -158,7 +158,7 @@ CL_EventIndex */ word CL_EventIndex( const char *name ) { - int i; + word i; if( !COM_CheckString( name )) return 0; @@ -484,7 +484,7 @@ void GAME_EXPORT CL_PlaybackEvent( int flags, const edict_t *pInvoker, word even return; // first check event for out of bounds - if( eventindex < 1 || eventindex > MAX_EVENTS ) + if( eventindex < 1 || eventindex >= MAX_EVENTS ) { Con_DPrintf( S_ERROR "CL_PlaybackEvent: invalid eventindex %i\n", eventindex ); return; diff --git a/engine/client/cl_frame.c b/engine/client/cl_frame.c index b86debed..dd1777e6 100644 --- a/engine/client/cl_frame.c +++ b/engine/client/cl_frame.c @@ -222,7 +222,7 @@ void CL_UpdateLatchedVars( cl_entity_t *ent ) if( ent->curstate.sequence != ent->prevstate.sequence ) { - memcpy( ent->latched.prevseqblending, ent->prevstate.blending, sizeof( ent->prevstate.blending )); + memcpy( ent->latched.prevseqblending, ent->prevstate.blending, sizeof( ent->latched.prevseqblending )); ent->latched.prevsequence = ent->prevstate.sequence; ent->latched.sequencetime = ent->curstate.animtime; }