Fix bug #3138 “pgpinline crashes on signature check if gppme fails to init”
authorRicardo Mones <ricardo@mones.org>
Sat, 12 Apr 2014 12:14:09 +0000 (14:14 +0200)
committerRicardo Mones <ricardo@mones.org>
Sun, 13 Apr 2014 09:26:52 +0000 (11:26 +0200)
src/plugins/pgpinline/pgpinline.c
src/plugins/pgpmime/pgpmime.c

index 2a60946..7ce5c13 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Colin Leroy <colin@colino.net> and 
+ * Copyright (C) 1999-2014 Colin Leroy <colin@colino.net> and
  * the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
@@ -137,8 +137,10 @@ static gboolean pgpinline_is_signed(MimeInfo *mimeinfo)
                data = pgpinline_new_privacydata();
                mimeinfo->privacy = (PrivacyData *) data;
        }
-       data->done_sigtest = TRUE;
-       data->is_signed = TRUE;
+       if (data != NULL) {
+               data->done_sigtest = TRUE;
+               data->is_signed = TRUE;
+       }
 
        return TRUE;
 }
@@ -449,12 +451,14 @@ static MimeInfo *pgpinline_decrypt(MimeInfo *mimeinfo)
                        data = pgpinline_new_privacydata();
                        decinfo->privacy = (PrivacyData *) data;        
                }
-               data->done_sigtest = TRUE;
-               data->is_signed = TRUE;
-               data->sigstatus = sigstat;
-               if (data->ctx)
-                       gpgme_release(data->ctx);
-               data->ctx = ctx;
+               if (data != NULL) {
+                       data->done_sigtest = TRUE;
+                       data->is_signed = TRUE;
+                       data->sigstatus = sigstat;
+                       if (data->ctx)
+                               gpgme_release(data->ctx);
+                       data->ctx = ctx;
+               }
        } else
                gpgme_release(ctx);
 
index 2a0bb7a..d22a85a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 the Claws Mail team
+ * Copyright (C) 1999-2014 the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -128,9 +128,10 @@ static gboolean pgpmime_is_signed(MimeInfo *mimeinfo)
                data = pgpmime_new_privacydata();
                mimeinfo->privacy = (PrivacyData *) data;
        }
-       
-       data->done_sigtest = TRUE;
-       data->is_signed = TRUE;
+       if (data != NULL) {
+               data->done_sigtest = TRUE;
+               data->is_signed = TRUE;
+       }
 
        return TRUE;
 }
@@ -421,12 +422,14 @@ static MimeInfo *pgpmime_decrypt(MimeInfo *mimeinfo)
                        data = pgpmime_new_privacydata();
                        decinfo->privacy = (PrivacyData *) data;        
                }
-               data->done_sigtest = TRUE;
-               data->is_signed = TRUE;
-               data->sigstatus = sigstat;
-               if (data->ctx)
-                       gpgme_release(data->ctx);
-               data->ctx = ctx;
+               if (data != NULL) {
+                       data->done_sigtest = TRUE;
+                       data->is_signed = TRUE;
+                       data->sigstatus = sigstat;
+                       if (data->ctx)
+                               gpgme_release(data->ctx);
+                       data->ctx = ctx;
+               }
        } else
                gpgme_release(ctx);