[PATCH] avifil32: Use matching buffer length for dest string (Coverity)
Nikolay Sivov
nsivov at codeweavers.com
Thu Mar 10 03:26:57 CST 2016
Reported issue is about potential overflow when copying to fixed size
buffer from larger source buffer
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
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++;
}
--
2.7.0
More information about the wine-patches
mailing list