]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
maildir: Detect duplicate keywords in dovecot-keywords file
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 3 Jun 2016 16:18:43 +0000 (19:18 +0300)
committerGitLab <gitlab@git.dovecot.net>
Fri, 3 Jun 2016 16:32:21 +0000 (19:32 +0300)
Use the first such keyword's index, not the last.

Also fixes assert-crashing in hash_table_insert() when it happens.

src/lib-storage/index/maildir/maildir-keywords.c

index bc8d34a7386c0e7d7a7f4aa5fd4d5f47b5ac9e36..161bd01286ec7c616773da8881b15dc071449c35 100644 (file)
@@ -168,7 +168,8 @@ static int maildir_keywords_sync(struct maildir_keywords *mk)
                *p++ = '\0';
 
                if (str_to_uint(line, &idx) < 0 ||
-                   idx >= MAILDIR_MAX_KEYWORDS || *p == '\0') {
+                   idx >= MAILDIR_MAX_KEYWORDS || *p == '\0' ||
+                   hash_table_lookup(mk->hash, p) != NULL) {
                        /* shouldn't happen */
                        continue;
                }