Skip to content

Commit

Permalink
Client: Statusbar: Fix bounds checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tmp64 committed Feb 27, 2022
1 parent f75ad47 commit 2b280e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/game/client/hud/statusbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ int CHudStatusBar::MsgFunc_StatusText(const char *pszName, int iSize, void *pbuf

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 @@ -251,7 +251,7 @@ int CHudStatusBar::MsgFunc_StatusValue(const char *pszName, int iSize, void *pbu
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

0 comments on commit 2b280e3

Please sign in to comment.