Re: svn commit: r1920247 - /apr/apr/trunk/ldap/apr_ldap.c
Yann Ylavic <[email protected]> Wed, 28 Aug 2024 16:27:21 +0200
| Newsgroups | gmane.comp.apache.apr.devel |
|---|---|
| Message-ID | <CAKQ1sVOdYqtcKPNPPsi6L8b=89iChEyKxtnS9CO4ET9t+_uq0A@mail.gmail.com> |
On Wed, Aug 28, 2024 at 3:47 PM Graham Leggett via dev <[email protected]> wrote: > > On 28 Aug 2024, at 13:02, Ruediger Pluem <[email protected]> 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.