Skip to content

Commit

Permalink
Fix status bar accepting out of range indices
Browse files Browse the repository at this point in the history
  • Loading branch information
hammermaps committed Apr 24, 2023
1 parent aca7506 commit 86d3496
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cl_dll/statusbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ int CHudStatusBar :: MsgFunc_StatusText( const char *pszName, int iSize, void *p

int line = READ_BYTE();

if ( line < 0 || line > MAX_STATUSBAR_LINES )
if (line < 0 || line >= MAX_STATUSBAR_LINES)
return 1;

strncpy( m_szStatusText[line], READ_STRING(), MAX_STATUSTEXT_LENGTH );
Expand All @@ -254,7 +254,7 @@ int CHudStatusBar :: MsgFunc_StatusValue( const char *pszName, int iSize, void *
BEGIN_READ( pbuf, iSize );

int index = READ_BYTE();
if ( index < 1 || index > MAX_STATUSBAR_VALUES )
if (index < 1 || index >= MAX_STATUSBAR_VALUES)
return 1; // index out of range

m_iStatusValues[index] = READ_SHORT();
Expand Down
2 changes: 1 addition & 1 deletion dlls/osprey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class COsprey : public CBaseMonster
int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
int ObjectCaps( void ) { return CBaseMonster :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
int TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType) override;
int TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType) override;

void Spawn( void );
void Precache( void );
Expand Down

0 comments on commit 86d3496

Please sign in to comment.