Hans Leidekker : msi: Avoid a crash when MIME entries point to non-existing extensions.

Alexandre Julliard julliard at winehq.org
Thu May 1 14:39:59 CDT 2014


Module: wine
Branch: master
Commit: 95d72ae6f012968486402ac82f2758b9ee44008c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=95d72ae6f012968486402ac82f2758b9ee44008c

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Thu May  1 10:07:23 2014 +0200

msi: Avoid a crash when MIME entries point to non-existing extensions.

---

 dlls/msi/classes.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/msi/classes.c b/dlls/msi/classes.c
index 2719a8e..df5c817 100644
--- a/dlls/msi/classes.c
+++ b/dlls/msi/classes.c
@@ -1452,14 +1452,14 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
 
     LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry )
     {
-        LPWSTR extension, key;
+        LPWSTR extension = NULL, key;
 
         /* 
          * check if the MIME is to be installed. Either as requested by an
          * extension or Class
          */
         if ((!mt->Class || mt->Class->action != INSTALLSTATE_LOCAL) &&
-            mt->Extension->action != INSTALLSTATE_LOCAL)
+            (!mt->Extension || mt->Extension->action != INSTALLSTATE_LOCAL))
         {
             TRACE("MIME %s not scheduled to be installed\n", debugstr_w(mt->ContentType));
             continue;
@@ -1467,7 +1467,7 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
 
         TRACE("Registering MIME type %s\n", debugstr_w(mt->ContentType));
 
-        extension = msi_alloc( (strlenW( mt->Extension->Extension ) + 2) * sizeof(WCHAR) );
+        if (mt->Extension) extension = msi_alloc( (strlenW( mt->Extension->Extension ) + 2) * sizeof(WCHAR) );
         key = msi_alloc( (strlenW( mt->ContentType ) + strlenW( szMIMEDatabase ) + 1) * sizeof(WCHAR) );
 
         if (extension && key)
@@ -1510,7 +1510,7 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package )
         LPWSTR mime_key;
 
         if ((!mime->Class || mime->Class->action != INSTALLSTATE_ABSENT) &&
-            mime->Extension->action != INSTALLSTATE_ABSENT)
+            (!mime->Extension || mime->Extension->action != INSTALLSTATE_ABSENT))
         {
             TRACE("MIME %s not scheduled to be removed\n", debugstr_w(mime->ContentType));
             continue;




More information about the wine-cvs mailing list