]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Add more mail_index_ext_name_is_valid() asserts
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 24 Sep 2021 13:36:41 +0000 (16:36 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 5 Oct 2021 07:44:52 +0000 (07:44 +0000)
src/lib-index/mail-index-map.c
src/lib-index/mail-index-sync-ext.c

index 32d6c47cf41b26ca9dffa4b9269da50477de386e..6ac2b93fc61e45c128e357941cda71bcef0f34fd 100644 (file)
@@ -71,6 +71,8 @@ mail_index_map_register_ext(struct mail_index_map *map,
        struct mail_index_ext *ext;
        uint32_t idx, ext_map_idx, empty_idx = (uint32_t)-1;
 
+       i_assert(mail_index_ext_name_is_valid(name));
+
        if (!array_is_created(&map->extensions)) {
                 mail_index_map_init_extbufs(map, 5);
                idx = 0;
index 975977117e7f6fdaffbe24eb36f7f4d7be29216c..1873f3326de070a435822ae7d84903696481ae5d 100644 (file)
@@ -364,6 +364,8 @@ mail_index_sync_ext_init_new(struct mail_index_sync_map_ctx *ctx,
        buffer_t *hdr_buf;
        uint32_t ext_map_idx;
 
+       i_assert(mail_index_ext_name_is_valid(name));
+
        /* be sure to get a unique mapping before we modify the extensions,
           otherwise other map users will see the new extension but not the
           data records that sync_ext_reorder() adds. */