[1/2] version: Fix wrong length reported when selecting a block. (resend 2)

Mark Jansen learn0more+wine at gmail.com
Wed Feb 18 15:41:41 CST 2015


This fixes the possibility of wrong info returned when Selecting a
Block item with VerQueryValueA.

---
 dlls/version/version.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
-------------- next part --------------
From f6b3f5126d53c750ab96338ddbfd4cd1c02b0927 Mon Sep 17 00:00:00 2001
From: Mark <learn0more at gmail.com>
Date: Mon, 9 Feb 2015 14:13:12 -0800
Subject: Fix wrong length returned when selecting a block

---
 dlls/version/version.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/version/version.c b/dlls/version/version.c
index 680fa31..6784c6a 100644
--- a/dlls/version/version.c
+++ b/dlls/version/version.c
@@ -952,6 +952,9 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
         BOOL ret, isText;
         INT len;
         LPWSTR lpSubBlockW;
+        UINT dum = 0;
+        if (!puLen)
+            puLen = &dum;
 
         len  = MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, NULL, 0);
         lpSubBlockW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
@@ -965,7 +968,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
 
         HeapFree(GetProcessHeap(), 0, lpSubBlockW);
 
-        if (ret && isText)
+        if (ret && isText && *puLen)
         {
             /* Set lpBuffer so it points to the 'empty' area where we store
              * the converted strings
-- 
1.9.1



More information about the wine-patches mailing list