]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict-ldap: Fix crash in synchronous dict_lookup()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 20 Jan 2022 17:10:41 +0000 (18:10 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Sun, 30 Jan 2022 10:03:50 +0000 (10:03 +0000)
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

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

index 435ef15569a0a318f5ae03d6bd3d2f4cf5f101a2..ec22c14f857c9163578a2f4acdb16abb76aae11b 100644 (file)
@@ -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);
 }