bpo-45375: Fix off by one error in buffer allocation (GH-28764)

This commit is contained in:
Steve Dower 2021-10-06 20:09:33 +01:00 committed by GitHub
parent 8e8f752217
commit 6c942a86a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -266,7 +266,7 @@ canonicalize(wchar_t *buffer, const wchar_t *path)
} }
if (PathIsRelativeW(path)) { if (PathIsRelativeW(path)) {
wchar_t buff[MAXPATHLEN]; wchar_t buff[MAXPATHLEN + 1];
if (!GetCurrentDirectoryW(MAXPATHLEN, buff)) { if (!GetCurrentDirectoryW(MAXPATHLEN, buff)) {
return _PyStatus_ERR("unable to find current working directory"); return _PyStatus_ERR("unable to find current working directory");
} }