[PATCH] ole32: Check array index limit first.

Huw Davies huw at codeweavers.com
Wed May 16 05:01:06 CDT 2018


On Wed, May 16, 2018 at 12:37:31PM +0300, Andrey Gusev wrote:
> Signed-off-by: Andrey Gusev <andrey.goosev at gmail.com>
> ---
>  dlls/ole32/filemoniker.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c
> index 271e5bb8a8..6e3b00e590 100644
> --- a/dlls/ole32/filemoniker.c
> +++ b/dlls/ole32/filemoniker.c
> @@ -1382,7 +1382,7 @@ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa
>                  }
>                  else
>  
> -                    if (lstrcmpW(tabStr[i],bkSlash)==0 && i<nb-1 && lstrcmpW(tabStr[i+1],bkSlash)==0){
> +                    if (lstrcmpW(tabStr[i+1],bkSlash)==0 && i<nb-1 && lstrcmpW(tabStr[i],bkSlash)==0){
>                          *tabStr[i]=0;
>                          sizeStr--;
>                          addBkSlash = FALSE;

This looks wrong.  What are you trying to fix here?  AFAICS tabStr
will have length nb (which is > 0), so the existing code is correct.

Huw.



More information about the wine-devel mailing list