mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +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
|
@ -134,6 +134,7 @@ spwd_getspnam_impl(PyObject *module, PyObject *arg)
|
|||
|
||||
if ((bytes = PyUnicode_EncodeFSDefault(arg)) == NULL)
|
||||
return NULL;
|
||||
/* check for embedded null bytes */
|
||||
if (PyBytes_AsStringAndSize(bytes, &name, NULL) == -1)
|
||||
goto out;
|
||||
if ((p = getspnam(name)) == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue