From 130b286d0daf3c571a90118ed6e035606547288e Mon Sep 17 00:00:00 2001 From: fgsfds Date: Thu, 14 Nov 2024 23:00:30 +0100 Subject: [PATCH] port: avoid stack corruption in bmoveProcessInput --- src/game/bondmove.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/game/bondmove.c b/src/game/bondmove.c index ede1b11d0..400cfa00c 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -907,7 +907,9 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i aimoffhist[i] = !aimonhist[i]; } - g_Vars.currentplayer->insightaimmode = aimonhist[numsamples - 1]; + if (numsamples > 0) { + g_Vars.currentplayer->insightaimmode = aimonhist[numsamples - 1]; + } } if (!lvIsPaused()) { @@ -1238,7 +1240,9 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i aimoffhist[i] = !aimonhist[i]; } - g_Vars.currentplayer->insightaimmode = aimonhist[numsamples - 1]; + if (numsamples > 0) { + g_Vars.currentplayer->insightaimmode = aimonhist[numsamples - 1]; + } } if (!lvIsPaused()) {