]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Added asserts to make sure invalid extension records aren't written to...
authorTimo Sirainen <tss@iki.fi>
Fri, 22 May 2015 20:37:07 +0000 (16:37 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 22 May 2015 20:37:07 +0000 (16:37 -0400)
src/lib-index/mail-index-transaction-export.c
src/lib-index/mail-index-transaction-update.c

index 692a346262a430845ba9ae5787e1a9854610f721..9d16c1e6b48080e5d6e03f319a169294ec7c00bb 100644 (file)
@@ -164,6 +164,7 @@ static void log_append_ext_intro(struct mail_index_export_context *ctx,
                                intro->hdr_size = hdr_update_size;
                }
        }
+       i_assert(intro->record_size != 0 || intro->hdr_size != 0);
        if (reset_id != 0) {
                /* we're going to reset this extension in this transaction */
                intro->reset_id = reset_id;
index 01f1be0117de38f3c1297fec33f229af9693d5d2..c130f904ced5a642777d65f9a31547e0a1791551 100644 (file)
@@ -979,6 +979,7 @@ void mail_index_update_ext(struct mail_index_transaction *t, uint32_t seq,
                rext = array_idx(&index->extensions, ext_id);
                record_size = rext->record_size;
        }
+       i_assert(record_size > 0);
 
        if (!array_is_created(&t->ext_rec_updates))
                i_array_init(&t->ext_rec_updates, ext_id + 2);