]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dict: dict_iterate() - Fix segfault with DICT_ITERATE_FLAG_NO_VALUE
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 23 Nov 2020 16:15:57 +0000 (18:15 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 23 Nov 2020 16:16:38 +0000 (18:16 +0200)
Broken by cf0d196c2b373a37bc1ab4e10fde89fb61089f3c

src/lib-dict/dict.c

index b6eff42228061464cd8a9165471ebe5dc6c18173..64bebe39c3d41d081ff6925ed2d08a8bde38c3d8 100644 (file)
@@ -386,7 +386,8 @@ bool dict_iterate(struct dict_iterate_context *ctx,
 
        if (!dict_iterate_values(ctx, key_r, &values))
                return FALSE;
-       *value_r = values[0];
+       if ((ctx->flags & DICT_ITERATE_FLAG_NO_VALUE) == 0)
+               *value_r = values[0];
        return TRUE;
 }