Title: Null dereferencing of a pointer in initconfig.c · Issue #160962 · python/cpython · GitHub
Open Graph Title: Null dereferencing of a pointer in initconfig.c · Issue #160962 · python/cpython
X Title: Null dereferencing of a pointer in initconfig.c · Issue #160962 · python/cpython
Description: Bug report Potentially, if "value" equals NULL and "spec->type" equals "PyConfig_MEMBER_WSTR_OPT", null will be passed into "utf8_to_wstr" function and might cause a segmentation fault in strlen cpython/Python/initconfig.c Lines 4369 to ...
Open Graph Description: Bug report Potentially, if "value" equals NULL and "spec->type" equals "PyConfig_MEMBER_WSTR_OPT", null will be passed into "utf8_to_wstr" function and might cause a segmentation fault in strlen cp...
X Description: Bug report Potentially, if "value" equals NULL and "spec->type" equals "PyConfig_MEMBER_WSTR_OPT", null will be passed into "utf8_to_wstr" function and mi...
Opengraph URL: https://github.com/python/cpython/issues/160962
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Null dereferencing of a pointer in initconfig.c","articleBody":"### Bug report\n\nPotentially, if \"value\" equals NULL and \"spec->type\" equals \"PyConfig_MEMBER_WSTR_OPT\", null will be passed into \"utf8_to_wstr\" function and might cause a segmentation fault in strlen\nhttps://github.com/python/cpython/blob/d3a1e7280bd74a16c5822cff9c77fa28da4d725e/Python/initconfig.c#L4369-L4376\nhttps://github.com/python/cpython/blob/d3a1e7280bd74a16c5822cff9c77fa28da4d725e/Python/initconfig.c#L4324-L4328\n\n[Documentation](https://chromium.googlesource.com/external/github.com/python/cpython/%2B/dc12d1999b88e84d5a6b8e491be468b73379e54b/Doc/c-api/init_config.rst#203) states that \"value\" is a null-terminated UTF-8 string, but isn't clearly stating that Null is allowed \n\nSuggested fix: separate \"value\" and \"spec->type\" checks\n```\nif (value == NULL) { \n if (spec->type != PyConfig_MEMBER_WSTR_OPT) {\n nitconfig_set_error(config, \"config option string cannot be NULL\");\n return -1;\n }\n wchar_t **member = raw_member;\n free(*member);\n *member = wstr;\n return 0;\n}\n```\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\n_No response_\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-161258\n* gh-161291\n* gh-161292\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/Aruise","@type":"Person","name":"Aruise"},"datePublished":"2026-10-30T10:21:46Z","url":"https://github.com/python/cpython/issues/160962"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:1970bf30-911f-36c3-f1ea-0ff3a7ea8a4d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DB64:3B07B3:E2D091:11C613C:6B023348 |
| html-safe-nonce | 4691635dcb47220240ab5d7a542561a25e66f4a4b14ffd900b6910ea76315add |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjY0OjNCMDdCMzpFMkQwOTE6MTFDNjEzQzo2QjAyMzM0OCIsInZpc2l0b3JfaWQiOiIzODkzNTg4Nzk5OTU5MjE2OTY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 235d2c5bf67cc8096fa58703f544daba69ea43455006dfafbc1bf5d4129cb264 |
| hovercard-subject-tag | issue:6117284697 |
| 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/cpython/160962/issue_layout |
| twitter:image | https://opengraph.githubassets.com/777ba95339222ebc1e728ab154d5d2d9e7943512ba7687dee08b0b24d5be059a/python/cpython/issues/160962 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/777ba95339222ebc1e728ab154d5d2d9e7943512ba7687dee08b0b24d5be059a/python/cpython/issues/160962 |
| og:image:alt | Bug report Potentially, if "value" equals NULL and "spec->type" equals "PyConfig_MEMBER_WSTR_OPT", null will be passed into "utf8_to_wstr" function and might cause a segmentation fault in strlen cp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Aruise |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width