diff options
author | Thomas Heller <theller@ctypes.org> | 2006-07-14 15:01:05 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2006-07-14 15:01:05 (GMT) |
commit | 9f902470da71f5b4e8142a2defd5aa0ffe474717 (patch) | |
tree | 39983b715f282be2f47d8903881f2e55f7c920db /Modules | |
parent | 7d1d43630e117fdc3ccb0a8c6a9b31ab7d443016 (diff) | |
download | cpython-9f902470da71f5b4e8142a2defd5aa0ffe474717.zip cpython-9f902470da71f5b4e8142a2defd5aa0ffe474717.tar.gz cpython-9f902470da71f5b4e8142a2defd5aa0ffe474717.tar.bz2 |
Make the prototypes of our private PyUnicode_FromWideChar and
PyUnicode_AsWideChar replacement functions compatible to the official
functions by using Py_ssize_t instead of int.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 7 | ||||
-rw-r--r-- | Modules/_ctypes/ctypes.h | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 2cbd5d5..8090f5c 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -4711,13 +4711,14 @@ init_ctypes(void) } /***************************************************************** - * replacements for broken Python api functions + * replacements for broken Python api functions (in Python 2.3). + * See #1047269 Buffer overwrite in PyUnicode_AsWideChar */ #ifdef HAVE_WCHAR_H PyObject *My_PyUnicode_FromWideChar(register const wchar_t *w, - int size) + Py_ssize_t size) { PyUnicodeObject *unicode; @@ -4749,7 +4750,7 @@ PyObject *My_PyUnicode_FromWideChar(register const wchar_t *w, int My_PyUnicode_AsWideChar(PyUnicodeObject *unicode, register wchar_t *w, - int size) + Py_ssize_t size) { if (unicode == NULL) { PyErr_BadInternalCall(); diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h index 6db7015..303eda3 100644 --- a/Modules/_ctypes/ctypes.h +++ b/Modules/_ctypes/ctypes.h @@ -377,8 +377,8 @@ extern char *conversion_mode_errors; # undef PyUnicode_AsWideChar # define PyUnicode_AsWideChar My_PyUnicode_AsWideChar -extern PyObject *My_PyUnicode_FromWideChar(const wchar_t *, int); -extern int My_PyUnicode_AsWideChar(PyUnicodeObject *, wchar_t *, int); +extern PyObject *My_PyUnicode_FromWideChar(const wchar_t *, Py_ssize_t); +extern int My_PyUnicode_AsWideChar(PyUnicodeObject *, wchar_t *, Py_ssize_t); #endif |