]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict-sql: Fix dict iteration with uuid type
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Sun, 14 May 2023 21:17:28 +0000 (00:17 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Sun, 14 May 2023 21:17:28 +0000 (00:17 +0300)
dict_iterate_next() is run in its own data stack frame, so the returned
values must not be allocated from data stack.

Broken by 9e46d634d493e9539b4da635138e7b3670b625f2

src/lib-dict-backend/dict-sql.c

index 302f47f2b6d419e8b2839339ee82b6f82da9f7b4..2f17ac8fde3b24b0f8a2126074d63bcc2721f5e1 100644 (file)
@@ -526,7 +526,7 @@ sql_dict_result_unescape(enum dict_sql_type type, pool_t pool,
                if (value == NULL)
                        return "";
                guid_128_from_uuid_string(value, guid);
-               return guid_128_to_uuid_string(guid, FORMAT_RECORD);
+               return p_strdup(pool, guid_128_to_uuid_string(guid, FORMAT_RECORD));
        case DICT_SQL_TYPE_HEXBLOB:
                break;
        case DICT_SQL_TYPE_COUNT: