dovecot-2.2: lib-storage: Fixed iterating attribute prefix that ...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Sep 11 11:03:31 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/d190ee84158b
changeset: 19142:d190ee84158b
user: Timo Sirainen <tss at iki.fi>
date: Fri Sep 11 14:02:01 2015 +0300
description:
lib-storage: Fixed iterating attribute prefix that matched the attribute itself.
So if attribute key was "foo", iterating "foo" returned garbage because it
skipped over the trailing \0.
diffstat:
src/lib-storage/mailbox-attribute.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (24 lines):
diff -r 179477c59392 -r d190ee84158b src/lib-storage/mailbox-attribute.c
--- a/src/lib-storage/mailbox-attribute.c Fri Sep 11 01:20:28 2015 +0300
+++ b/src/lib-storage/mailbox-attribute.c Fri Sep 11 14:02:01 2015 +0300
@@ -131,10 +131,17 @@
if (plen > 0) {
if (strncmp(key, bare_prefix, plen) != 0)
return;
- if (key[plen] != '/' && strlen(key) != plen)
+ if (key[plen] == '/') {
+ /* remove prefix */
+ key += plen + 1;
+ } else if (key[plen] == '\0') {
+ /* list the key itself, so this becomes an
+ empty key string. it's the same as how the
+ dict backend works too. */
+ key += plen;
+ } else {
return;
- /* remove prefix */
- key += plen + 1;
+ }
}
if (have_dict || regs[i].rank == MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY)
array_append(attrs, &key, 1);
More information about the dovecot-cvs
mailing list