version: Handle NULL puLen parameter for VerQueryValueA/W

Bruno Jesus 00cpxxx at gmail.com
Tue Nov 11 20:03:59 CST 2014


Rebased version of patch from Jeff Zaroyko.

Tests were attempted but they crash in NT4 and 2000. It's possible to
add tests if a GetVersion() check is added to test for different
windows versions, I'm trying the simplified attempt first. Test
results:
https://testbot.winehq.org/JobDetails.pl?Key=10201

Fixes https://bugs.winehq.org/show_bug.cgi?id=16832
-------------- next part --------------
diff --git a/dlls/version/version.c b/dlls/version/version.c
index 9bc6ad1..58fd029 100644
--- a/dlls/version/version.c
+++ b/dlls/version/version.c
@@ -976,7 +976,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
             len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, -1,
                                       lpBufferA + pos, info->wLength - pos, NULL, NULL);
             *lplpBuffer = lpBufferA + pos;
-            *puLen = len;
+            if (puLen) *puLen = len;
         }
         return ret;
     }
@@ -1036,7 +1036,7 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock,
             len = MultiByteToWideChar(CP_ACP, 0, *lplpBuffer, -1,
                                       lpBufferW + pos, max/sizeof(WCHAR) - pos );
             *lplpBuffer = lpBufferW + pos;
-            *puLen = len;
+            if (puLen) *puLen = len;
         }
         return ret;
     }


More information about the wine-patches mailing list