From a9760098f7c944961a3ea674750c0c6240713ead Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Wed, 26 Feb 2020 22:28:02 +0900 Subject: [PATCH] [CMD] Correctly parse drive-decorated pathname (#2382) Correctly interpret the drive-decorated pathnames (C: or D:dir1 etc). CORE-15871 --- base/shell/cmd/dir.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/base/shell/cmd/dir.c b/base/shell/cmd/dir.c index e6c2f869111..5750dd236b8 100644 --- a/base/shell/cmd/dir.c +++ b/base/shell/cmd/dir.c @@ -1770,7 +1770,14 @@ ResolvePattern( * they are part of the actual directory path; the exception being if * these are the special "." or ".." directories. */ - if (pszPatternPart == NULL) + if (_istalpha(pNextDir[0]) && pNextDir[1] == _T(':') && pNextDir[2] != _T('\\')) + { + /* + * The syntax ":" without any trailing backslash actually + * means: "current directory on this drive". + */ + } + else if (pszPatternPart == NULL) { ASSERT(pszFullPath[_tcslen(pszFullPath)-1] == _T('\\'));