Browse code

Fixes null-dereference in mail message parser.

Micah Snyder (micasnyd) authored on 2019/11/07 04:18:19
Showing 2 changed files
... ...
@@ -3840,7 +3840,7 @@ do_multipart(message *mainMessage, message **messages, int i, mbox_status *rc, m
3840 3840
 
3841 3841
         thisobj = messageGetJObj(aMessage);
3842 3842
         if (thisobj == NULL) {
3843
-            cli_errmsg("Cannot get message preclass object\n");
3843
+            cli_dbgmsg("Cannot get message preclass object\n");
3844 3844
             *rc = -1;
3845 3845
             return mainMessage;
3846 3846
         }
... ...
@@ -2632,7 +2632,9 @@ int isuuencodebegin(const char *line)
2632 2632
 #if HAVE_JSON
2633 2633
 json_object *messageGetJObj(message *m)
2634 2634
 {
2635
-    assert(m != NULL);
2635
+    if (m == NULL) {
2636
+        return NULL;
2637
+    }
2636 2638
 
2637 2639
     if (m->jobj == NULL)
2638 2640
         m->jobj = cli_jsonobj(NULL, NULL);