summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-28 16:01:59 (GMT)
committerGitHub <noreply@github.com>2019-06-28 16:01:59 (GMT)
commitec3e20a2d1edddb0558f9d32e2b367904ccdde88 (patch)
tree4cb63b0ccbaf0d9cbdb0d6257b03b6337ae2823c /Modules/posixmodule.c
parent3029035ef34c9bae0c8d965290cd9b273c8de1ea (diff)
downloadcpython-ec3e20a2d1edddb0558f9d32e2b367904ccdde88.zip
cpython-ec3e20a2d1edddb0558f9d32e2b367904ccdde88.tar.gz
cpython-ec3e20a2d1edddb0558f9d32e2b367904ccdde88.tar.bz2
bpo-37412: Fix os.getcwd() for long path on Windows (GH-14424)
* Fix test for integer overflow. * Add an unit test.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 197607c..b848710 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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 {