MSI Crash

Ulrich Czekalla ulrich.czekalla at utoronto.ca
Wed Feb 9 12:14:10 CST 2005


This patch fixes a crash in builtin MSI

ChangeLog:
    Ulrich Czekalla <ulrich at codeweavers.com>
    Handle 0 length buffers in MSI_FormatRecordW
    Remove unused buffer in deformat_string
-------------- next part --------------
Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.84
diff -u -p -r1.84 action.c
--- dlls/msi/action.c	9 Feb 2005 13:58:20 -0000	1.84
+++ dlls/msi/action.c	9 Feb 2005 18:09:49 -0000
@@ -518,10 +518,9 @@ DWORD deformat_string(MSIPACKAGE *packag
     {
         MSIRECORD *rec = MSI_CreateRecord(1);
         DWORD size = 0;
-        WCHAR size_buf[2] = {' ',0};
 
         MSI_RecordSetStringW(rec,0,ptr);
-        MSI_FormatRecordW(package,rec,size_buf,&size);
+        MSI_FormatRecordW(package,rec,NULL,&size);
         if (size >= 0)
         {
             size++;
Index: dlls/msi/format.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/format.c,v
retrieving revision 1.4
diff -u -p -r1.4 format.c
--- dlls/msi/format.c	2 Feb 2005 09:30:22 -0000	1.4
+++ dlls/msi/format.c	9 Feb 2005 18:09:49 -0000
@@ -451,9 +451,12 @@ UINT MSI_FormatRecordW( MSIPACKAGE* pack
         }
         else
         {
-            memcpy(buffer,deformated,(*size)*sizeof(WCHAR));
+            if (*size > 0)
+            {
+                memcpy(buffer,deformated,(*size)*sizeof(WCHAR));
+                buffer[(*size)-1] = 0;
+            }
             rc = ERROR_MORE_DATA;
-            buffer[(*size)-1] = 0;    
         }
     }
     else


More information about the wine-patches mailing list