From 98e48b5a92b5b304aea7c44f1e78ca1bc8d62ebd Mon Sep 17 00:00:00 2001 From: Dmitry Gorbachev Date: Tue, 26 Jul 2011 03:24:48 +0000 Subject: [PATCH] [WIN32K] Do not go beyond the MouseHistoryOfMoves[] bounds. Fixes a crash in Win32k. svn path=/trunk/; revision=52887 --- reactos/subsystems/win32/win32k/ntuser/msgqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index 35ed255edaa..f7aa35318db 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -616,7 +616,8 @@ co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook MouseHistoryOfMoves[gcur_count].y = Msg->pt.y; MouseHistoryOfMoves[gcur_count].time = Msg->time; MouseHistoryOfMoves[gcur_count].dwExtraInfo = dwExtraInfo; - if (gcur_count++ == 64) gcur_count = 0; // 0 - 63 is 64, FIFO forwards. + if (++gcur_count == ARRAYSIZE(MouseHistoryOfMoves)) + gcur_count = 0; // 0 - 63 is 64, FIFO forwards. } //