mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-37412: Fix os.getcwd() for long path on Windows (GH-14424)
* Fix test for integer overflow. * Add an unit test.
This commit is contained in:
parent
3029035ef3
commit
ec3e20a2d1
2 changed files with 56 additions and 1 deletions
|
|
@ -3334,7 +3334,7 @@ posix_getcwd(int use_bytes)
|
|||
terminating \0. If the buffer is too small, len includes
|
||||
the space needed for the terminator. */
|
||||
if (len >= Py_ARRAY_LENGTH(wbuf)) {
|
||||
if (len >= PY_SSIZE_T_MAX / sizeof(wchar_t)) {
|
||||
if (len <= PY_SSIZE_T_MAX / sizeof(wchar_t)) {
|
||||
wbuf2 = PyMem_RawMalloc(len * sizeof(wchar_t));
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue