From: Aki Tuomi Date: Fri, 6 Oct 2023 06:24:38 +0000 (+0300) Subject: lib-dict: dict-fs - Allocate key from iteration pool X-Git-Tag: 2.4.0~2548 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f9d0b643dc025557b0784bc8f6b92e526556f63;p=thirdparty%2Fdovecot%2Fcore.git lib-dict: dict-fs - Allocate key from iteration pool Path gets allocated from stack memory, which causes it to become invalidated before used by clients. Broken in 32e8bd5b5a9d5bc04e5ac6c65ac132ba5c386d64 --- diff --git a/src/lib-dict-extra/dict-fs.c b/src/lib-dict-extra/dict-fs.c index f9c3750b09..9ba9d0be1d 100644 --- a/src/lib-dict-extra/dict-fs.c +++ b/src/lib-dict-extra/dict-fs.c @@ -204,12 +204,12 @@ static bool fs_dict_iterate(struct dict_iterate_context *ctx, } iter->key_count++; - path = t_strconcat(iter->path, *key_r, NULL); + p_clear(iter->value_pool); + path = p_strconcat(iter->value_pool, iter->path, *key_r, NULL); if ((iter->flags & DICT_ITERATE_FLAG_NO_VALUE) != 0) { *key_r = path; return TRUE; } - p_clear(iter->value_pool); struct dict_op_settings set = { .username = ctx->set.username, };