mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03: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
|
|
@ -594,8 +594,12 @@ summary_setproperty(msiobj* si, PyObject *args)
|
|||
return NULL;
|
||||
|
||||
if (PyUnicode_Check(data)) {
|
||||
WCHAR *value = _PyUnicode_AsUnicode(data);
|
||||
if (value == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
status = MsiSummaryInfoSetPropertyW(si->h, field, VT_LPSTR,
|
||||
0, NULL, PyUnicode_AsUnicode(data));
|
||||
0, NULL, value);
|
||||
} else if (PyLong_CheckExact(data)) {
|
||||
long value = PyLong_AsLong(data);
|
||||
if (value == -1 && PyErr_Occurred()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue