Title: _ldap.str2dn() segfaults when called with empty string · Issue #549 · python-ldap/python-ldap · GitHub
Open Graph Title: _ldap.str2dn() segfaults when called with empty string · Issue #549 · python-ldap/python-ldap
X Title: _ldap.str2dn() segfaults when called with empty string · Issue #549 · python-ldap/python-ldap
Description: Issue description: _ldap.str2dn segfaults with a NULL pointer deref when called with an empty string as argument. ldap_bv2dn return success for an empty string and sets dn pointer to NULL. Debug builds of OpenLDAP fail with an assertion ...
Open Graph Description: Issue description: _ldap.str2dn segfaults with a NULL pointer deref when called with an empty string as argument. ldap_bv2dn return success for an empty string and sets dn pointer to NULL. Debug bu...
X Description: Issue description: _ldap.str2dn segfaults with a NULL pointer deref when called with an empty string as argument. ldap_bv2dn return success for an empty string and sets dn pointer to NULL. Debug bu...
Opengraph URL: https://github.com/python-ldap/python-ldap/issues/549
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"_ldap.str2dn() segfaults when called with empty string","articleBody":"Issue description:\r\n\r\n`_ldap.str2dn` segfaults with a NULL pointer deref when called with an empty string as argument. `ldap_bv2dn` return success for an empty string and sets `dn` pointer to NULL. Debug builds of OpenLDAP fail with an assertion error `getdn.c:710: ldap_bv2dn_x: Assertion bvin-\u003ebv_val != NULL failed.`. Our code does not handle NULL `dn` and empty string correctly. Fix is trivial.\r\n\r\n```\r\n\u003e\u003e\u003e _ldap.str2dn(\"\")\r\n\r\nProgram received signal SIGSEGV, Segmentation fault.\r\nl_ldap_str2dn (unused=\u003coptimized out\u003e, args=\u003coptimized out\u003e) at Modules/functions.c:118\r\nDownloading source file /usr/src/debug/python-ldap-3.4.3-2.fc38.x86_64/Modules/functions.c\r\n118 for (i = 0; dn[i]; i++) { \r\n(gdb) bt\r\n#0 l_ldap_str2dn (unused=\u003coptimized out\u003e, args=\u003coptimized out\u003e) at Modules/functions.c:118\r\n#1 0x00007ffff7bcef08 in cfunction_call (func=0x7fffe9e2f240, args=\u003coptimized out\u003e, kwargs=\u003coptimized out\u003e)\r\n at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Objects/methodobject.c:553\r\n#2 0x00007ffff7bb2173 in _PyObject_MakeTpCall (tstate=0x7ffff7f10538 \u003c_PyRuntime+166328\u003e, callable=0x7fffe9e2f240, args=\u003coptimized out\u003e, nargs=1, \r\n keywords=\u003coptimized out\u003e) at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Objects/call.c:214\r\n#3 0x00007ffff7bba996 in _PyEval_EvalFrameDefault (tstate=\u003coptimized out\u003e, frame=\u003coptimized out\u003e, throwflag=\u003coptimized out\u003e)\r\n at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Python/ceval.c:4760\r\n#4 0x00007ffff7bb6bba in _PyEval_EvalFrame (throwflag=0, frame=0x7ffff763d020, tstate=0x7ffff7f10538 \u003c_PyRuntime+166328\u003e)\r\n at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Include/internal/pycore_ceval.h:73\r\n#5 _PyEval_Vector (tstate=tstate@entry=0x7ffff7f10538 \u003c_PyRuntime+166328\u003e, func=func@entry=0x7fffe9f8c540, locals=locals@entry=0x7ffff773b200, \r\n args=args@entry=0x0, argcount=argcount@entry=0, kwnames=kwnames@entry=0x0) at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Python/ceval.c:6425\r\n#6 0x00007ffff7c3b15c in PyEval_EvalCode (co=0x7fffe9d9fb40, globals=\u003coptimized out\u003e, locals=0x7ffff773b200)\r\n at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Python/ceval.c:1140\r\n#7 0x00007ffff7c58413 in run_eval_code_obj (tstate=tstate@entry=0x7ffff7f10538 \u003c_PyRuntime+166328\u003e, co=co@entry=0x7fffe9d9fb40, \r\n globals=globals@entry=0x7ffff773b200, locals=locals@entry=0x7ffff773b200) at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Python/pythonrun.c:1710\r\n#8 0x00007ffff7c54a7a in run_mod (mod=mod@entry=0x55555572eba8, filename=filename@entry=0x7ffff76ec230, globals=0x7ffff773b200, locals=0x7ffff773b200, \r\n flags=flags@entry=0x7fffffffd068, arena=arena@entry=0x7ffff765f990) at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Python/pythonrun.c:1731\r\n#9 0x00007ffff7b99732 in PyRun_InteractiveOneObjectEx (fp=fp@entry=0x7ffff79f6aa0 \u003c_IO_2_1_stdin_\u003e, filename=filename@entry=0x7ffff76ec230, \r\n flags=flags@entry=0x7fffffffd068) at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Python/pythonrun.c:261\r\n#10 0x00007ffff7b998d2 in _PyRun_InteractiveLoopObject (fp=0x7ffff79f6aa0 \u003c_IO_2_1_stdin_\u003e, filename=0x7ffff76ec230, flags=0x7fffffffd068)\r\n at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Python/pythonrun.c:138\r\n#11 0x00007ffff7b2688b in _PyRun_AnyFileObject (fp=0x7ffff79f6aa0 \u003c_IO_2_1_stdin_\u003e, filename=0x7ffff76ec230, closeit=0, flags=0x7fffffffd068)\r\n at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Python/pythonrun.c:73\r\n#12 0x00007ffff7b99a4f in PyRun_AnyFileExFlags (fp=0x7ffff79f6aa0 \u003c_IO_2_1_stdin_\u003e, filename=\u003coptimized out\u003e, closeit=0, flags=0x7fffffffd068)\r\n at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Python/pythonrun.c:105\r\n#13 0x00007ffff7b22793 in pymain_run_stdin (config=0x7ffff7ef6580 \u003c_PyRuntime+59904\u003e) at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Modules/main.c:509\r\n#14 pymain_run_python (exitcode=0x7fffffffd060) at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Modules/main.c:604\r\n#15 Py_RunMain () at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Modules/main.c:680\r\n#16 0x00007ffff7c2b48b in Py_BytesMain (argc=\u003coptimized out\u003e, argv=\u003coptimized out\u003e) at /usr/src/debug/python3.11-3.11.6-1.fc38.x86_64/Modules/main.c:734\r\n#17 0x00007ffff7849b8a in __libc_start_call_main (main=main@entry=0x555555555160 \u003cmain\u003e, argc=argc@entry=1, argv=argv@entry=0x7fffffffd2c8)\r\n at ../sysdeps/nptl/libc_start_call_main.h:58\r\n#18 0x00007ffff7849c4b in __libc_start_main_impl (main=0x555555555160 \u003cmain\u003e, argc=1, argv=0x7fffffffd2c8, init=\u003coptimized out\u003e, fini=\u003coptimized out\u003e, \r\n rtld_fini=\u003coptimized out\u003e, stack_end=0x7fffffffd2b8) at ../csu/libc-start.c:360\r\n#19 0x0000555555555095 in _start ()\r\n(gdb) p dn\r\n$1 = (LDAPDN) 0x0\r\n```\r\n\r\n\r\n\r\n\r\nSteps to reproduce: \r\n\r\n```\r\nimport _ldap\r\n_ldap.str2dn(\"\")\r\n```\r\n\r\n\r\nOperating system: \r\nany\r\n\r\nPython version: \r\nany\r\n\r\npython-ldap version: \r\n3.4.3","author":{"url":"https://github.com/tiran","@type":"Person","name":"tiran"},"datePublished":"2023-11-15T06:00:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/549/python-ldap/issues/549"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d2c2d764-31c1-852e-24d8-5f107c482e16 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 82C4:242157:44ADDD4:59D150D:6974EA18 |
| html-safe-nonce | a8f3f48bedc35e90f9e298fd2045cba667a5d73d18cf57fe3ab03d6aea3abc20 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkM0OjI0MjE1Nzo0NEFEREQ0OjU5RDE1MEQ6Njk3NEVBMTgiLCJ2aXNpdG9yX2lkIjoiODIyODM2NTkyODc1NjQ3MjM0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 964f843b273ca89cd066147700b9b076b888f6f5b911e1097f3504683d1a2bb7 |
| hovercard-subject-tag | issue:1994103828 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-ldap/python-ldap/549/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d6ad1348aa350619bd46d217fbd4fccfc1678a33cfb1d3b38f621031ef2547a9/python-ldap/python-ldap/issues/549 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d6ad1348aa350619bd46d217fbd4fccfc1678a33cfb1d3b38f621031ef2547a9/python-ldap/python-ldap/issues/549 |
| og:image:alt | Issue description: _ldap.str2dn segfaults with a NULL pointer deref when called with an empty string as argument. ldap_bv2dn return success for an empty string and sets dn pointer to NULL. Debug bu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tiran |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f |
| turbo-cache-control | no-preview |
| go-import | github.com/python-ldap/python-ldap git https://github.com/python-ldap/python-ldap.git |
| octolytics-dimension-user_id | 33895877 |
| octolytics-dimension-user_login | python-ldap |
| octolytics-dimension-repository_id | 111794776 |
| octolytics-dimension-repository_nwo | python-ldap/python-ldap |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 111794776 |
| octolytics-dimension-repository_network_root_nwo | python-ldap/python-ldap |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 488b30e96dfd057fbbe44c6665ccbc030b729dde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width