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

zooba webhook-mailer at python.org
Wed Oct 6 15:09:42 EDT 2021


https://github.com/python/cpython/commit/6c942a86a4fb4c8b731cb1bd2933dba554eb79cd
commit: 6c942a86a4fb4c8b731cb1bd2933dba554eb79cd
branch: main
author: Steve Dower <steve.dower at python.org>
committer: zooba <steve.dower at microsoft.com>
date: 2021-10-06T20:09:33+01:00
summary:

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

files:
M PC/getpathp.c

diff --git a/PC/getpathp.c b/PC/getpathp.c
index 98a754976c670..062697b3e9afd 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -266,7 +266,7 @@ canonicalize(wchar_t *buffer, const wchar_t *path)
     }
 
     if (PathIsRelativeW(path)) {
-        wchar_t buff[MAXPATHLEN];
+        wchar_t buff[MAXPATHLEN + 1];
         if (!GetCurrentDirectoryW(MAXPATHLEN, buff)) {
             return _PyStatus_ERR("unable to find current working directory");
         }



More information about the Python-checkins mailing list