Fix crash on attachment decryption
authorAndre Heinecke <aheinecke@intevation.de>
Wed, 21 Oct 2015 12:22:16 +0000 (14:22 +0200)
committerAndre Heinecke <aheinecke@intevation.de>
Wed, 21 Oct 2015 12:22:16 +0000 (14:22 +0200)
* src/attachment.cpp (do_crypt): Check return value of mapiobject.

--
It appears that sometimes a "Ghost" attachment is listed
by outlook. That attachment does not have a Mapiobject or
GpgOL properties attached to it. So we ignore it.

src/attachment.cpp

index b7e7102..66588d5 100644 (file)
@@ -294,6 +294,13 @@ do_crypt (LPDISPATCH mailitem, bool protect)
         }
       mapi_attachment = (LPATTACH) get_oom_iunknown (attachment,
                                                      "MapiObject");
+      if (!mapi_attachment)
+        {
+          log_debug ("%s:%s: Failed to get MapiObject of attachment: %p",
+                     SRCNAME, __func__, attachment);
+          attachment->Release ();
+          continue;
+        }
 
       att_type = get_gpgolattachtype (mapi_attachment, tag_id);
       if ((protect && att_type == ATTACHTYPE_FROMMOSS_DEC) ||