diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-06-28 06:27:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-28 06:27:35 (GMT) |
commit | 0834905d9b61291b1fc5e05a1ffbc69de9c9379f (patch) | |
tree | 456e79426ec816ba7e0a0bef7e94a6f8423b2786 /PC/_msi.c | |
parent | 413c0a92bcc92efe92849fe5e711163da453410b (diff) | |
download | cpython-0834905d9b61291b1fc5e05a1ffbc69de9c9379f.zip cpython-0834905d9b61291b1fc5e05a1ffbc69de9c9379f.tar.gz cpython-0834905d9b61291b1fc5e05a1ffbc69de9c9379f.tar.bz2 |
[3.6] bpo-13617: Reject embedded null characters in wchar* strings. (GH-2302) (#2462)
Based on patch by Victor Stinner.
Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters..
(cherry picked from commit f7eae0adfcd4c50034281b2c69f461b43b68db84)
Diffstat (limited to 'PC/_msi.c')
-rw-r--r-- | PC/_msi.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -600,8 +600,12 @@ summary_setproperty(msiobj* si, PyObject *args) return NULL; if (PyUnicode_Check(data)) { + const 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()) { |