mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
gh-130567: Fix possible crash in locale.strxfrm() (GH-138940)
On some macOS versions there was an off-by-one error in wcsxfrm() which caused writing past the end of the array if its size was not calculated by running wcsxfrm() first. Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
This commit is contained in:
parent
6b4e3fe9d4
commit
5854cf38a2
2 changed files with 5 additions and 1 deletions
|
|
@ -0,0 +1,2 @@
|
|||
Fix possible crash in :func:`locale.strxfrm` due to a platform bug on
|
||||
macOS.
|
||||
|
|
@ -457,7 +457,9 @@ _locale_strxfrm_impl(PyObject *module, PyObject *str)
|
|||
|
||||
/* assume no change in size, first */
|
||||
n1 = n1 + 1;
|
||||
buf = PyMem_New(wchar_t, n1);
|
||||
/* Yet another +1 is needed to work around a platform bug in wcsxfrm()
|
||||
* on macOS. See gh-130567. */
|
||||
buf = PyMem_New(wchar_t, n1+1);
|
||||
if (!buf) {
|
||||
PyErr_NoMemory();
|
||||
goto exit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue