setupapi: Fix buffer overflow in SetupGetFileCompressionInfoW.

Thomas Faber thomas.faber at reactos.org
Thu Mar 27 07:59:09 CDT 2014


From 8c453427e8218a55b6ae5cfe645bd6c57dd59dea Mon Sep 17 00:00:00 2001
From: Thomas Faber <thomas.faber at reactos.org>
Date: Thu, 27 Mar 2014 13:54:13 +0100
Subject: setupapi: Fix buffer overflow in SetupGetFileCompressionInfoW.

---
 dlls/setupapi/misc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/setupapi/misc.c b/dlls/setupapi/misc.c
index 22e55d9..6bdb404 100644
--- a/dlls/setupapi/misc.c
+++ b/dlls/setupapi/misc.c
@@ -1412,7 +1412,8 @@ DWORD WINAPI SetupGetFileCompressionInfoW( PCWSTR source, PWSTR *name, PDWORD so
         return ERROR_INVALID_PARAMETER;
 
     ret = SetupGetFileCompressionInfoExW( source, NULL, 0, &required, NULL, NULL, NULL );
-    if (!(actual_name = MyMalloc( required ))) return ERROR_NOT_ENOUGH_MEMORY;
+    if (!(actual_name = MyMalloc( required * sizeof(WCHAR) )))
+        return ERROR_NOT_ENOUGH_MEMORY;
 
     ret = SetupGetFileCompressionInfoExW( source, actual_name, required, &required,
                                           source_size, target_size, type );
-- 
1.9.0.msysgit.0



More information about the wine-patches mailing list