avifil32: Use matching buffer length for dest string (Coverity).

Reported issue is about potential overflow when copying to fixed size
buffer from larger source buffer

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-03-10 12:26:57 +03:00 committed by Alexandre Julliard
parent a411ef99fc
commit 94c1c8e504
1 changed files with 6 additions and 4 deletions

View File

@ -1036,14 +1036,16 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
return AVIERR_ERROR; return AVIERR_ERROR;
} }
for (n = 0;RegEnumKeyW(hKey, n, szFileExt, sizeof(szFileExt)/sizeof(szFileExt[0])) == ERROR_SUCCESS;n++) { for (n = 0;RegEnumKeyW(hKey, n, szFileExt, sizeof(szFileExt)/sizeof(szFileExt[0])) == ERROR_SUCCESS;n++) {
WCHAR clsidW[40];
/* get CLSID to extension */ /* get CLSID to extension */
size = sizeof(szValue); size = sizeof(clsidW);
if (RegQueryValueW(hKey, szFileExt, szValue, &size) != ERROR_SUCCESS) if (RegQueryValueW(hKey, szFileExt, clsidW, &size) != ERROR_SUCCESS)
break; break;
/* search if the CLSID is already known */ /* search if the CLSID is already known */
for (i = 1; i <= count; i++) { for (i = 1; i <= count; i++) {
if (lstrcmpW(lp[i].szClsid, szValue) == 0) if (lstrcmpW(lp[i].szClsid, clsidW) == 0)
break; /* a new one */ break; /* a new one */
} }
@ -1058,7 +1060,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
break; break;
} }
lstrcpyW(lp[i].szClsid, szValue); lstrcpyW(lp[i].szClsid, clsidW);
count++; count++;
} }