From: Timo Sirainen Date: Thu, 20 Jan 2022 17:10:41 +0000 (+0100) Subject: dict-ldap: Fix crash in synchronous dict_lookup() X-Git-Tag: 2.4.0~4606 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1270f38994d0ef9148ca51a5d4e5cdc64ab15834;p=thirdparty%2Fdovecot%2Fcore.git dict-ldap: Fix crash in synchronous dict_lookup() However, this code could never actually be called. All dict-ldap lookups go through dict process, which uses only dict_lookup_async(). Broken by 4453ca75c600ed35643d0775b16848cafae9eaea --- diff --git a/src/lib-dict-backend/dict-ldap.c b/src/lib-dict-backend/dict-ldap.c index 435ef15569..ec22c14f85 100644 --- a/src/lib-dict-backend/dict-ldap.c +++ b/src/lib-dict-backend/dict-ldap.c @@ -300,7 +300,10 @@ void ldap_dict_lookup_done(const struct dict_lookup_result *result, void *ctx) { struct dict_lookup_result *res = ctx; res->ret = result->ret; - res->value = t_strdup(result->value); + if (result->ret > 0) { + res->values = p_strarray_dup(pool_datastack_create(), + result->values); + } res->error = t_strdup(result->error); }