Fix array overflow

svn path=/trunk/; revision=7249
This commit is contained in:
Gé van Geldorp 2003-12-26 10:47:20 +00:00
parent c8c4b549eb
commit 7ff57296b2

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: timer.c,v 1.19 2003/12/23 21:34:52 navaraf Exp $ /* $Id: timer.c,v 1.20 2003/12/26 10:47:20 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -383,6 +383,7 @@ IntKillTimer(HWND hWnd, UINT_PTR uIDEvent, BOOL SystemTimer)
return TRUE; return TRUE;
} }
extern VOID STDCALL ValidateNonPagedPool(VOID);
static VOID STDCALL_FUNC static VOID STDCALL_FUNC
TimerThreadMain(PVOID StartContext) TimerThreadMain(PVOID StartContext)
{ {
@ -445,6 +446,8 @@ TimerThreadMain(PVOID StartContext)
if (CurrentTime.QuadPart >= MsgTimer->Timeout.QuadPart) if (CurrentTime.QuadPart >= MsgTimer->Timeout.QuadPart)
{ {
EnumEntry = EnumEntry->Flink;
RemoveEntryList(&MsgTimer->ListEntry); RemoveEntryList(&MsgTimer->ListEntry);
/* /*
@ -463,7 +466,11 @@ TimerThreadMain(PVOID StartContext)
++ThreadsToDereferencePos; ++ThreadsToDereferencePos;
//set up next periodic timeout //set up next periodic timeout
do
{
MsgTimer->Timeout.QuadPart += (MsgTimer->Period * 10000); MsgTimer->Timeout.QuadPart += (MsgTimer->Period * 10000);
}
while (MsgTimer->Timeout.QuadPart <= CurrentTime.QuadPart);
IntInsertTimerAscendingOrder(MsgTimer, FALSE); IntInsertTimerAscendingOrder(MsgTimer, FALSE);
} }
else else
@ -471,7 +478,6 @@ TimerThreadMain(PVOID StartContext)
break; break;
} }
EnumEntry = EnumEntry->Flink;
} }
EnumEntry = SysTimerListHead.Flink; EnumEntry = SysTimerListHead.Flink;
@ -481,6 +487,8 @@ TimerThreadMain(PVOID StartContext)
if (CurrentTime.QuadPart >= MsgTimer2->Timeout.QuadPart) if (CurrentTime.QuadPart >= MsgTimer2->Timeout.QuadPart)
{ {
EnumEntry = EnumEntry->Flink;
RemoveEntryList(&MsgTimer2->ListEntry); RemoveEntryList(&MsgTimer2->ListEntry);
/* /*
@ -499,15 +507,17 @@ TimerThreadMain(PVOID StartContext)
++ThreadsToDereferencePos; ++ThreadsToDereferencePos;
//set up next periodic timeout //set up next periodic timeout
do
{
MsgTimer2->Timeout.QuadPart += (MsgTimer2->Period * 10000); MsgTimer2->Timeout.QuadPart += (MsgTimer2->Period * 10000);
}
while (MsgTimer2->Timeout.QuadPart <= CurrentTime.QuadPart);
IntInsertTimerAscendingOrder(MsgTimer2, TRUE); IntInsertTimerAscendingOrder(MsgTimer2, TRUE);
} }
else else
{ {
break; break;
} }
EnumEntry = EnumEntry->Flink;
} }
//set up next timeout from first entry (if any) //set up next timeout from first entry (if any)