[Python-checkins] bpo-38822: Check specifically for a drive, not just a colon (GH-25540)

zooba webhook-mailer at python.org
Thu Apr 22 19:56:53 EDT 2021


https://github.com/python/cpython/commit/28575923a9ee40928a9d00a7ed997a6f6a09b8d1
commit: 28575923a9ee40928a9d00a7ed997a6f6a09b8d1
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: zooba <steve.dower at microsoft.com>
date: 2021-04-23T00:56:45+01:00
summary:

bpo-38822: Check specifically for a drive, not just a colon (GH-25540)

(cherry picked from commit e07d8098892e85ecc56969d2c9a5afb3ea33ce8f)

Co-authored-by: Steve Dower <steve.dower at python.org>

files:
M Modules/posixmodule.c

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 35d63188e02f7..c984e2e93f3c0 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1808,8 +1808,8 @@ attributes_from_dir(LPCWSTR pszFile, BY_HANDLE_FILE_INFORMATION *info, ULONG *re
         while (--n > 0 && (filename[n] == L'\\' || filename[n] == L'/')) {
             ((LPWSTR)filename)[n] = L'\0';
         }
-        if (!n || filename[n] == L':') {
-            // Nothing left te query
+        if (!n || (n == 1 && filename[1] == L':')) {
+            // Nothing left to query
             free((void *)filename);
             return FALSE;
         }



More information about the Python-checkins mailing list