diff src/libpst.c @ 345:a8577226f7a9

fixes from AJ Shankar for attachment processing and body encodings that contain embedded null chars
author Carl Byington <carl@five-ten-sg.com>
date Mon, 09 Mar 2015 10:47:58 -0700
parents 5d0dc4db45b3
children 09dd5299d91c
line wrap: on
line diff
--- a/src/libpst.c	Mon Mar 09 08:49:47 2015 -0700
+++ b/src/libpst.c	Mon Mar 09 10:47:58 2015 -0700
@@ -1304,7 +1304,10 @@
         DEBUG_INFO(("ATTACHMENT processing attachment\n"));
         list = pst_parse_block(pf, id2_ptr->id->i_id, id2_head);
         if (!list) {
-            DEBUG_WARN(("ERROR error processing main attachment record\n"));
+            if (item->flags & PST_FLAG_HAS_ATTACHMENT) {
+                // Only report an error if we expected to see an attachment table and didn't.
+                DEBUG_WARN(("ERROR error processing main attachment record\n"));
+            }
             if (!m_head) pst_free_id2(id2_head);
             DEBUG_RET();
             return item;
@@ -1351,7 +1354,9 @@
                     continue;
                 }
                 pst_free_list(list);
-                id2_ptr = pst_getID2(id2_head, attach->id2_val);
+                // As per 2.4.6.2 in the spec, the attachment data is stored as a child of the
+                // attachment object, so we pass in id2_ptr as the head to search from.
+                id2_ptr = pst_getID2(id2_ptr, attach->id2_val);
                 if (id2_ptr) {
                     DEBUG_WARN(("second pass attachment updating id2 %#"PRIx64" found i_id %#"PRIx64"\n", attach->id2_val, id2_ptr->id->i_id));
                     // i_id has been updated to the datablock containing the attachment data