]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mailbox_attribute_get*() - Fail early on with empty key lookup
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 26 Oct 2022 23:56:45 +0000 (02:56 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 26 Oct 2022 23:56:45 +0000 (02:56 +0300)
This fixes using mail_attribute_dict with dict-sql.

src/lib-storage/mailbox-attribute.c

index 29999c304ab452a3e8482509c40f15ddb3a3e7ea..873cc3ec813aa8cab7084c37ee11327699f8e642 100644 (file)
@@ -364,6 +364,11 @@ mailbox_attribute_get_common(struct mailbox *box,
        const struct mailbox_attribute_internal *iattr;
        int ret;
 
+       if (key[0] == '\0') {
+               /* never exists, and may cause dict lookup errors */
+               return 0;
+       }
+
        iattr = mailbox_internal_attribute_get(type_flags, key);
 
        /* allow internal server attributes only for the inbox */