Huw Davies : dplayx: Prevent out-of-bounds access to lpMemArea.
Module: wine Branch: master Commit: 18e532d6452e45772c0d435bfefd1fbf68442e58 URL: https://source.winehq.org/git/wine.git/?a=commit;h=18e532d6452e45772c0d435bf... Author: Huw Davies <huw(a)codeweavers.com> Date: Wed May 30 13:01:56 2018 +0100 dplayx: Prevent out-of-bounds access to lpMemArea. Based on a patch by Andrey Gusev. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dplayx/dplayx_global.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/dplayx/dplayx_global.c b/dlls/dplayx/dplayx_global.c index 14c53a0..bc087c8 100644 --- a/dlls/dplayx/dplayx_global.c +++ b/dlls/dplayx/dplayx_global.c @@ -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;
participants (1)
-
Alexandre Julliard