[PATCH] oleaut32: incorrect sizeof() to MultiByteToWideChar (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Feb 8 01:23:03 CST 2014


either 39 or 40 bytes ... just use 40 now. And sizeof()
1169908 Out-of-bounds access
---
 dlls/oleaut32/tests/typelib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 84b9023..9148887 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -3982,12 +3982,12 @@ static void test_dump_typelib(const char *name)
         /* compare type uuid */
         if (ti->uuid && *ti->uuid)
         {
-            WCHAR guidW[39] = {0};
+            WCHAR guidW[40] = {0};
             ITypeInfo *typeinfo2;
             HRESULT hr;
             GUID guid;
 
-            MultiByteToWideChar(CP_ACP, 0, ti->uuid, -1, guidW, 40);
+            MultiByteToWideChar(CP_ACP, 0, ti->uuid, -1, guidW, sizeof(guidW)/sizeof(guidW[0]));
             IIDFromString(guidW, &guid);
             expect_guid(&guid, &typeattr->guid);
 
-- 
1.8.4.5




More information about the wine-patches mailing list