]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38822: Check specifically for a drive, not just a colon (GH-25540)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 22 Apr 2021 23:56:45 +0000 (16:56 -0700)
committerGitHub <noreply@github.com>
Thu, 22 Apr 2021 23:56:45 +0000 (00:56 +0100)
(cherry picked from commit e07d8098892e85ecc56969d2c9a5afb3ea33ce8f)

Co-authored-by: Steve Dower <steve.dower@python.org>
Modules/posixmodule.c

index 35d63188e02f769d0e4d97ae50bbb23074e69912..c984e2e93f3c0442b4f1835a79c9c6ea00d9c366 100644 (file)
@@ -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;
         }