[3.6] bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). (GH-2285) (#2443)
Raise a ValueError if the second argument is NULL and the wchar_t\*
string contains null characters..
(cherry picked from commit e613e6add5f07ff6aad5802924596b631b707d2a)
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index d88d06e..41b831e 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -345,7 +345,7 @@
if (PyUnicode_Check(obj)) {
#ifdef HAVE_NCURSESW
assert (wstr != NULL);
- *wstr = PyUnicode_AsWideCharString(obj, NULL);
+ *wstr = _PyUnicode_AsWideCharString(obj);
if (*wstr == NULL)
return 0;
return 2;