From 97661cd4f6b6f63f6c81dec89c5dfad46c23c9d9 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 21 Mar 2017 20:36:25 +0100 Subject: [PATCH] System.IO.Path.IsPathRooted does not check if valid drive letter on Windows (dotnet/coreclr#10323) Commit migrated from https://github.com/dotnet/coreclr/commit/e21d073e5e2b1d258cfef9111656d46884b242e7 --- src/coreclr/src/mscorlib/shared/System/IO/Path.Windows.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/mscorlib/shared/System/IO/Path.Windows.cs b/src/coreclr/src/mscorlib/shared/System/IO/Path.Windows.cs index 0f8e3b3..d6f0c62 100644 --- a/src/coreclr/src/mscorlib/shared/System/IO/Path.Windows.cs +++ b/src/coreclr/src/mscorlib/shared/System/IO/Path.Windows.cs @@ -114,7 +114,7 @@ namespace System.IO } // Tests if the given path contains a root. A path is considered rooted - // if it starts with a backslash ("\") or a drive letter and a colon (":"). + // if it starts with a backslash ("\") or a valid drive letter and a colon (":"). public static bool IsPathRooted(string path) { if (path != null) @@ -123,7 +123,7 @@ namespace System.IO int length = path.Length; if ((length >= 1 && PathInternal.IsDirectorySeparator(path[0])) || - (length >= 2 && path[1] == PathInternal.VolumeSeparatorChar)) + (length >= 2 && PathInternal.IsValidDriveChar(path[0]) && path[1] == PathInternal.VolumeSeparatorChar)) return true; } return false; -- 2.7.4