On Wed, Aug 28, 2024 at 3:47 PM Graham Leggett via dev <dev@apr.apache.org> wrote: > > On 28 Aug 2024, at 13:02, Ruediger Pluem <rpl...@apache.org> wrote: > > >> - apr_buffer_mem_set(&buf, vals[k]->bv_val, > >> vals[k]->bv_len); > >> -// fixme - tell cb if binary > >> + if (binary) { > >> + apr_buffer_mem_set(&buf, vals[k]->bv_val, > >> vals[k]->bv_len); > >> + } > >> + else { > >> + str = strndup(vals[k]->bv_val, > >> vals[k]->bv_len); > > > > Why do we need the strndup? > > Further up we get the data from ldap_get_values_len(), which gives us fixed > length results instead of strings. > > https://linux.die.net/man/3/ldap_get_values_len > > Alas ldap_get_values() is deprecated, so we can't use it.
But the "binary" buffer is not nul_terminated either so why the non-binary should be if not provided as such in the first place? Regards; Yann.