mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[security] bpo-13617: Reject embedded null characters in wchar* strings. (#2302)
Based on patch by Victor Stinner. Add private C API function _PyUnicode_AsUnicode() which is similar to PyUnicode_AsUnicode(), but checks for null characters.
This commit is contained in:
parent
592eda1233
commit
f7eae0adfc
22 changed files with 115 additions and 23 deletions
|
@ -151,6 +151,7 @@ grp_getgrnam_impl(PyObject *module, PyObject *name)
|
|||
|
||||
if ((bytes = PyUnicode_EncodeFSDefault(name)) == NULL)
|
||||
return NULL;
|
||||
/* check for embedded null bytes */
|
||||
if (PyBytes_AsStringAndSize(bytes, &name_chars, NULL) == -1)
|
||||
goto out;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue