[PATCH] msi: avoid potential overflow

Marcus Meissner marcus at jet.franken.de
Sat Sep 3 15:55:29 CDT 2016


the create_test_guid function uses MAX_PATH characters
on both passed strings. While it never fully fills them, just
pass in buffers of that size.

Signed-off-by: Marcus Meissner <marcus at jet.franken.de>
---
 dlls/msi/tests/msi.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index feeb1ff..cb80779 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -12946,8 +12946,8 @@ static void test_MsiEnumProducts(void)
     UINT r;
     BOOL found1, found2, found3;
     DWORD index;
-    char product1[39], product2[39], product3[39], guid[39];
-    char product_squashed1[33], product_squashed2[33], product_squashed3[33];
+    char product1[MAX_PATH], product2[MAX_PATH], product3[MAX_PATH], guid[39];
+    char product_squashed1[MAX_PATH], product_squashed2[MAX_PATH], product_squashed3[MAX_PATH];
     char keypath1[MAX_PATH], keypath2[MAX_PATH], keypath3[MAX_PATH];
     char *usersid;
     HKEY key1, key2, key3;
@@ -13072,8 +13072,8 @@ static void test_MsiEnumProductsEx(void)
     UINT r;
     DWORD len, index;
     MSIINSTALLCONTEXT context;
-    char product0[39], product1[39], product2[39], product3[39], guid[39], sid[128];
-    char product_squashed1[33], product_squashed2[33], product_squashed3[33];
+    char product0[MAX_PATH], product1[MAX_PATH], product2[MAX_PATH], product3[MAX_PATH], guid[39], sid[128];
+    char product_squashed1[MAX_PATH], product_squashed2[MAX_PATH], product_squashed3[MAX_PATH];
     char keypath1[MAX_PATH], keypath2[MAX_PATH], keypath3[MAX_PATH];
     HKEY key1 = NULL, key2 = NULL, key3 = NULL;
     REGSAM access = KEY_ALL_ACCESS;
@@ -13235,8 +13235,8 @@ static void test_MsiEnumComponents(void)
     UINT r;
     BOOL found1, found2;
     DWORD index;
-    char comp1[39], comp2[39], guid[39];
-    char comp_squashed1[33], comp_squashed2[33];
+    char comp1[MAX_PATH], comp2[MAX_PATH], guid[MAX_PATH];
+    char comp_squashed1[MAX_PATH], comp_squashed2[MAX_PATH];
     char keypath1[MAX_PATH], keypath2[MAX_PATH];
     REGSAM access = KEY_ALL_ACCESS;
     char *usersid = get_user_sid();
@@ -13302,8 +13302,8 @@ static void test_MsiEnumComponentsEx(void)
     BOOL found1, found2;
     DWORD len, index;
     MSIINSTALLCONTEXT context;
-    char comp1[39], comp2[39], guid[39], sid[128];
-    char comp_squashed1[33], comp_squashed2[33];
+    char comp1[MAX_PATH], comp2[MAX_PATH], guid[39], sid[128];
+    char comp_squashed1[MAX_PATH], comp_squashed2[MAX_PATH];
     char keypath1[MAX_PATH], keypath2[MAX_PATH];
     HKEY key1 = NULL, key2 = NULL;
     REGSAM access = KEY_ALL_ACCESS;
-- 
2.9.3




More information about the wine-patches mailing list