Fix a crash in GpgOL introduced by last fix gpg4win-3.1.6
authorAndre Heinecke <aheinecke@gnupg.org>
Wed, 27 Mar 2019 11:56:54 +0000 (12:56 +0100)
committerAndre Heinecke <aheinecke@gnupg.org>
Wed, 27 Mar 2019 11:56:54 +0000 (12:56 +0100)
--

Makefile.am
patches/gpgol-2.3.3/0001-Fix-crash-when-looking-at-messages-without-attachs.patch [new file with mode: 0755]

index a6cf9fb..33700a5 100644 (file)
@@ -48,7 +48,8 @@ EXTRA_DIST = autogen.sh README.GIT ONEWS \
         patches/breeze-icons/0001-Make-binary-icons-cross-compilable.patch \
         patches/gpgme-1.13.0/0001-core-w32-glib-Fix-build-of-w32-glib-io.c.patch \
         patches/gpgol-2.3.3/0001-Replace-fancy-attribute-by-comment.patch \
-        patches/gpgol-2.3.3/0001-Fix-content-type-detection-for-headerless-mails.patch
+        patches/gpgol-2.3.3/0001-Fix-content-type-detection-for-headerless-mails.patch \
+        patches/gpgol-2.3.3/0001-Fix-crash-when-looking-at-messages-without-attachs.patch
 
 copy-news:
        cp NEWS doc/website/NEWS.last
diff --git a/patches/gpgol-2.3.3/0001-Fix-crash-when-looking-at-messages-without-attachs.patch b/patches/gpgol-2.3.3/0001-Fix-crash-when-looking-at-messages-without-attachs.patch
new file mode 100755 (executable)
index 0000000..d8fda40
--- /dev/null
@@ -0,0 +1,34 @@
+#! /bin/sh
+patch -p1 -l -f $* < $0
+exit $?
+
+From 20a0f3aa1b347862e4000ecde116ea6c5eec98a9 Mon Sep 17 00:00:00 2001
+From: Andre Heinecke <aheinecke@gnupg.org>
+Date: Wed, 27 Mar 2019 12:53:10 +0100
+Subject: [PATCH] Fix crash when looking at messages without attachs
+
+* src/mapihelp.cpp (mapi_get_first_attach_data): Do not crash
+if message has no attachments.
+---
+ src/mapihelp.cpp | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp
+index 1b13076..4a4d0e9 100644
+--- a/src/mapihelp.cpp
++++ b/src/mapihelp.cpp
+@@ -488,6 +488,12 @@ mapi_get_first_attach_data (LPMESSAGE message)
+     }
+
+   mapi_attach_item_t *table = mapi_create_attach_table (message, 0);
++  if (!table)
++    {
++      log_debug ("%s:%s: Message has no attachments",
++                 SRCNAME, __func__);
++      TRETURN ret;
++    }
+   if (table->end_of_table)
+     {
+       log_debug ("%s:%s: Message has no attachments",
+--
+2.20.1