From: Timo Sirainen Date: Wed, 26 Oct 2022 23:56:45 +0000 (+0300) Subject: lib-storage: mailbox_attribute_get*() - Fail early on with empty key lookup X-Git-Tag: 2.4.0~3492 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3118a9ef18a84dadcbef71cfad4f3221fd02ad11;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: mailbox_attribute_get*() - Fail early on with empty key lookup This fixes using mail_attribute_dict with dict-sql. --- diff --git a/src/lib-storage/mailbox-attribute.c b/src/lib-storage/mailbox-attribute.c index 29999c304a..873cc3ec81 100644 --- a/src/lib-storage/mailbox-attribute.c +++ b/src/lib-storage/mailbox-attribute.c @@ -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 */