Module: wine Branch: master Commit: 94c1c8e504edb82cd112c71fc6427991713685c8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=94c1c8e504edb82cd112c71fc6...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Thu Mar 10 12:26:57 2016 +0300
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
---
dlls/avifil32/api.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/avifil32/api.c b/dlls/avifil32/api.c index 7232450..0715d58 100644 --- a/dlls/avifil32/api.c +++ b/dlls/avifil32/api.c @@ -1036,14 +1036,16 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving) return AVIERR_ERROR; } for (n = 0;RegEnumKeyW(hKey, n, szFileExt, sizeof(szFileExt)/sizeof(szFileExt[0])) == ERROR_SUCCESS;n++) { + WCHAR clsidW[40]; + /* get CLSID to extension */ - size = sizeof(szValue); - if (RegQueryValueW(hKey, szFileExt, szValue, &size) != ERROR_SUCCESS) + size = sizeof(clsidW); + if (RegQueryValueW(hKey, szFileExt, clsidW, &size) != ERROR_SUCCESS) break;
/* search if the CLSID is already known */ for (i = 1; i <= count; i++) { - if (lstrcmpW(lp[i].szClsid, szValue) == 0) + if (lstrcmpW(lp[i].szClsid, clsidW) == 0) break; /* a new one */ }
@@ -1058,7 +1060,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving) break; }
- lstrcpyW(lp[i].szClsid, szValue); + lstrcpyW(lp[i].szClsid, clsidW);
count++; }