| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
`l_ldap_str2dn` crashes with a NULL pointer deref when an empty string or None is passed in. `ldap_bv2dn` returns success with NULL dn for an empty berval struct. In debug builds, `ldap_bv2dn` fails with an assertion error. The function now returns an empty list for an empty input. Note: The public API of python-ldap is not affected. The wrapper `ldap.dn.str2dn` does not pass an empty string to the low-level function. Fixes: python-ldap#549 Signed-off-by: Christian Heimes <cheimes@redhat.com>
|
ldap_bv2dn() accepts an empty string "", returning a NULL dn which is what l_ldap_str2dn doesn't handle. I admit it's not documented that it's not an empty list (what's expected here). But I think passing None (= NULL) to ldap_bv2dn() should (still) raise an error (ValueError?). |
Sorry, something went wrong.
|
No, ldap_bv2dn() is not designed to take an empty string as berval input. The code has an assert bvin->bv_val != NULL, which fails and crashes with an empty string when OpenLDAP is compiled with asserts enabled. The ticket has more details. |
Sorry, something went wrong.
|
The function accepts None because it uses z# to parse the input value. z# accepts an UTF-8 string, bytes-like object, or None. |
Sorry, something went wrong.
You're talking about different things:
The first is allowed, the other two are not. |
Sorry, something went wrong.
And what I'm saying is we raise ValueError on None? Others are handled as usual. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
l_ldap_str2dn crashes with a NULL pointer deref when an empty string or None is passed in. ldap_bv2dn returns success with NULL dn for an empty berval struct. In debug builds, ldap_bv2dn fails with an assertion error.
The function now returns an empty list for an empty input.
Note: The public API of python-ldap is not affected. The wrapper ldap.dn.str2dn does not pass an empty string to the low-level function.
Fixes: #549