summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2021-10-30 21:28:11 +0200
committer hap <happppp@users.noreply.github.com>2021-10-30 21:28:25 +0200
commitc6993affc6fd77115fcf2a45ee6d8f97414f6cda (patch)
treefb50a5b1c90b1a4191da1a2b6e0255bea23e87e9 /src/osd
parentcee44b0414ba5614991f9e355f66db48758531e5 (diff)
osdcore: fix buffer overflow with osd_output stack
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/osdcore.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/osd/osdcore.cpp b/src/osd/osdcore.cpp
index f5860416381..cb935df1759 100644
--- a/src/osd/osdcore.cpp
+++ b/src/osd/osdcore.cpp
@@ -26,7 +26,7 @@ static int m_ptr = -1;
void osd_output::push(osd_output *delegate)
{
- if (m_ptr < MAXSTACK)
+ if (m_ptr < MAXSTACK - 1)
{
delegate->m_chain = (m_ptr >= 0 ? m_stack[m_ptr] : nullptr);
m_ptr++;
@@ -37,7 +37,7 @@ void osd_output::push(osd_output *delegate)
void osd_output::pop(osd_output *delegate)
{
int f = -1;
- for (int i=0; i<=m_ptr; i++)
+ for (int i = 0; i <= m_ptr; i++)
if (m_stack[i] == delegate)
{
f = i;