Pierre Schweitzer : setupapi: Fix string conversion in SetupGetInfInformationA().

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 9 09:54:48 CST 2015


Module: wine
Branch: master
Commit: fe41140664ab43ccced49b45831324635db03d43
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fe41140664ab43ccced49b45831324635db03d43

Author: Pierre Schweitzer <pierre at reactos.org>
Date:   Sun Feb  8 19:57:18 2015 +0100

setupapi: Fix string conversion in SetupGetInfInformationA().

---

 dlls/setupapi/query.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/setupapi/query.c b/dlls/setupapi/query.c
index f21bc36..eaeadc0 100644
--- a/dlls/setupapi/query.c
+++ b/dlls/setupapi/query.c
@@ -125,8 +125,13 @@ BOOL WINAPI SetupGetInfInformationA(LPCVOID InfSpec, DWORD SearchControl,
 
     if (InfSpec && SearchControl >= INFINFO_INF_NAME_IS_ABSOLUTE)
     {
-        len = lstrlenA(InfSpec) + 1;
+        len = MultiByteToWideChar(CP_ACP, 0, InfSpec, -1, NULL, 0);
         inf = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+        if (!inf)
+        {
+            SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+            return FALSE;
+        }
         MultiByteToWideChar(CP_ACP, 0, InfSpec, -1, inf, len);
     }
 




More information about the wine-cvs mailing list