Mike McCormack : msi: Don't crash when logging a record with only one field .

Alexandre Julliard julliard at wine.codeweavers.com
Wed Mar 22 15:09:00 CST 2006


Module: wine
Branch: refs/heads/master
Commit: e1fdf3e24c977f71b83a43650bcc57d6c7be089d
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=e1fdf3e24c977f71b83a43650bcc57d6c7be089d

Author: Mike McCormack <mike at codeweavers.com>
Date:   Wed Mar 22 21:39:36 2006 +0900

msi: Don't crash when logging a record with only one field.

---

 dlls/msi/package.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index eb486ac..24a23d6 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -615,26 +615,27 @@ INT MSI_ProcessMessage( MSIPACKAGE *pack
     if ((eMessageType & 0xff000000) == INSTALLMESSAGE_ACTIONSTART)
     {
         static const WCHAR template_s[]=
-            {'A','c','t','i','o','n',' ','%','s',':',' ','%','s','.',' ', '%','s',
-            '.',0};
+            {'A','c','t','i','o','n',' ','%','s',':',' ','%','s','.',' ',0};
         static const WCHAR format[] = 
             {'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0};
         WCHAR timet[0x100];
-        LPCWSTR action_text;
-        LPCWSTR action;
-        LPWSTR deformated;
+        LPCWSTR action_text, action;
+        LPWSTR deformatted = NULL;
 
         GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, format, timet, 0x100);
 
         action = MSI_RecordGetString(record, 1);
         action_text = MSI_RecordGetString(record, 2);
-        deformat_string(package, action_text, &deformated);
+        deformat_string(package, action_text, &deformatted);
 
-        len = strlenW(timet) + strlenW(action) + strlenW(deformated) + 
-              strlenW(template_s) - 6 /* 6 characters of format specifier */;
-        message = msi_alloc((len + 1)*sizeof(WCHAR));
-        sprintfW(message,template_s,timet,action,deformated);
-        msi_free(deformated);
+        len = strlenW(timet) + strlenW(action) + strlenW(template_s);
+        if (deformatted)
+            len += strlenW(deformatted);
+        message = msi_alloc(len*sizeof(WCHAR));
+        sprintfW(message, template_s, timet, action);
+        if (deformatted)
+            strcatW(message, deformatted);
+        msi_free(deformatted);
     }
     else
     {




More information about the wine-cvs mailing list