[PATCH 2/2] oleaut32: Fixing null terminator in SysReAllocStringLen (try 2).

Alexander Kochetkov al.kochet at gmail.com
Wed Oct 14 03:15:39 CDT 2009


-------------- next part --------------
From af788b37a120d324ec6e0600023538b5217cb51a Mon Sep 17 00:00:00 2001
From: Alexander Kochetkov <al.kochet at gmail.com>
Date: Wed, 14 Oct 2009 11:37:20 +0400
Subject: [PATCH 2/2] oleaut32: Fixing null terminator in SysReAllocStringLen.
To: wine-patches <wine-patches at winehq.org>
Reply-To: wine-devel <wine-devel at winehq.org>

---
 dlls/oleaut32/oleaut.c        |    5 +++++
 dlls/oleaut32/tests/vartype.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/oleaut32/oleaut.c b/dlls/oleaut32/oleaut.c
index 896d6d4..e2c7dc6 100644
--- a/dlls/oleaut32/oleaut.c
+++ b/dlls/oleaut32/oleaut.c
@@ -306,6 +306,11 @@ int WINAPI SysReAllocStringLen(BSTR* old, const OLECHAR* str, unsigned int len)
 	 * when 'in' is NULL!
 	 * Some Microsoft program needs it.
 	 */
+
+	/* Another hidden feature: Windows always returns string with
+	 * the null terminator.
+	 */
+        (*old)[len] = 0;
       }
     } else {
       /*
diff --git a/dlls/oleaut32/tests/vartype.c b/dlls/oleaut32/tests/vartype.c
index 6374100..9a475a9 100644
--- a/dlls/oleaut32/tests/vartype.c
+++ b/dlls/oleaut32/tests/vartype.c
@@ -5408,7 +5408,7 @@ static void test_SysReAllocStringLen(void)
       if (str)
       {
         ok (str == oldstr, "Expected reuse of the old string memory\n");
-        todo_wine ok (str[STRING_SIZE] == 0,
+        ok (str[STRING_SIZE] == 0,
             "Expected null terminator, got 0x%04X\n", str[STRING_SIZE]);
         SysFreeString(str);
       }
-- 
1.6.0.4


More information about the wine-patches mailing list