dplayx: Prevent out-of-bounds access to lpMemArea.

Based on a patch by Andrey Gusev.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2018-05-30 13:01:56 +01:00 committed by Alexandre Julliard
parent 8d0444826d
commit 18e532d645
1 changed files with 2 additions and 2 deletions

View File

@ -120,9 +120,9 @@ static LPVOID DPLAYX_PrivHeapAlloc( DWORD flags, DWORD size )
/* Find blank area */
uBlockUsed = 0;
while( lpMemArea[ uBlockUsed ].used && uBlockUsed <= dwMaxBlock ) { uBlockUsed++; }
while( uBlockUsed < dwMaxBlock && lpMemArea[ uBlockUsed ].used ) { uBlockUsed++; }
if( uBlockUsed <= dwMaxBlock )
if( uBlockUsed < dwMaxBlock )
{
/* Set the area used */
lpMemArea[ uBlockUsed ].used = TRUE;