msi: terminate W->A string if space

Aric Stewart aric at codeweavers.com
Mon Sep 5 14:39:56 CDT 2005


be sure to null terminate the string in MsiGetProductInfoA after the 
W->A converstion using MsiGetProductInfoW if there is space.
-------------- next part --------------
Index: dlls/msi/msi.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/msi.c,v
retrieving revision 1.97
diff -u -r1.97 msi.c
--- dlls/msi/msi.c	10 Aug 2005 13:02:43 -0000	1.97
+++ dlls/msi/msi.c	5 Sep 2005 19:32:16 -0000
@@ -500,8 +500,13 @@
                             &pcchwValueBuf );
 
     if( ERROR_SUCCESS == r )
+    {
+        INT old_len = *pcchValueBuf;
         *pcchValueBuf = WideCharToMultiByte(CP_ACP, 0, szwBuffer, pcchwValueBuf,
                         szBuffer, *pcchValueBuf, NULL, NULL);
+        if (old_len > *pcchValueBuf)
+            szBuffer[*pcchValueBuf]=0;
+    }
 
 end:
     HeapFree( GetProcessHeap(), 0, szwProduct );



More information about the wine-patches mailing list