From: Steve Dower Date: Thu, 22 Apr 2021 23:30:37 +0000 (+0100) Subject: bpo-38222: Check specifically for a drive, not just a colon (GH-25540) X-Git-Tag: v3.10.0b1~207 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e07d8098892e85ecc56969d2c9a5afb3ea33ce8f;p=thirdparty%2FPython%2Fcpython.git bpo-38222: Check specifically for a drive, not just a colon (GH-25540) --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 7a5a0e9e8dd2..85e1e6976da1 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1860,8 +1860,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; }