]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Verify validity of ext-intro records in transaction log.
authorTimo Sirainen <tss@iki.fi>
Sun, 12 Aug 2012 21:29:38 +0000 (00:29 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 12 Aug 2012 21:29:38 +0000 (00:29 +0300)
src/lib-index/mail-transaction-log-view.c

index 14be6f301ac3ec4c5e3aa8960ee84eaf3637fe7c..c6514e5ba5cfe3c9250eb6c6e93c2646aaf87dfa 100644 (file)
@@ -586,6 +586,27 @@ log_view_is_record_valid(struct mail_transaction_log_file *file,
                array_create_from_buffer(&uids, &uid_buf,
                        sizeof(struct mail_transaction_keyword_reset));
                break;
+       case MAIL_TRANSACTION_EXT_INTRO: {
+               const struct mail_transaction_ext_intro *rec;
+               unsigned int i;
+
+               for (i = 0; i < rec_size; ) {
+                       if (i + sizeof(*rec) > rec_size) {
+                               /* should be just extra padding */
+                               break;
+                       }
+
+                       rec = CONST_PTR_OFFSET(data, i);
+                       if (i + sizeof(*rec) + rec->name_size > rec_size) {
+                               mail_transaction_log_file_set_corrupted(file,
+                                       "ext intro: name_size too large");
+                               return FALSE;
+                       }
+                       i += sizeof(*rec) + rec->name_size;
+                       if ((i % 4) != 0)
+                               i += 4 - (i % 4);
+               }
+       }
        default:
                break;
        }