aboutsummaryrefslogtreecommitdiff
path: root/src/path/filepath/path_windows_test.go
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2022-12-12 16:43:37 -0800
committerGopher Robot <gobot@golang.org>2023-02-14 16:51:16 +0000
commit95eb5abd6340b271ae728f99986eeccbc0354ab1 (patch)
tree1d964b7dd47b4083a61eb0deabe1833c2635401e /src/path/filepath/path_windows_test.go
parent117fe2e08d2fb385e4febed020b834d2d8e4358a (diff)
downloadgo-95eb5abd6340b271ae728f99986eeccbc0354ab1.tar.xz
path/filepath: do not Clean("a/../c:/b") into c:\b on Windows
Do not permit Clean to convert a relative path into one starting with a drive reference. This change causes Clean to insert a . path element at the start of a path when the original path does not start with a volume name, and the first path element would contain a colon. This may introduce a spurious but harmless . path element under some circumstances. For example, Clean("a/../b:/../c") becomes `.\c`. This reverts CL 401595, since the change here supersedes the one in that CL. Thanks to RyotaK (https://twitter.com/ryotkak) for reporting this issue. Fixes #57274 Fixes CVE-2022-41722 Change-Id: I837446285a03aa74c79d7642720e01f354c2ca17 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1675249 Reviewed-by: Roland Shoemaker <bracewell@google.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Julie Qiu <julieqiu@google.com> TryBot-Result: Security TryBots <security-trybots@go-security-trybots.iam.gserviceaccount.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/468123 Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/path/filepath/path_windows_test.go')
-rw-r--r--src/path/filepath/path_windows_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/path/filepath/path_windows_test.go b/src/path/filepath/path_windows_test.go
index 8553485a2d..42aeb4f619 100644
--- a/src/path/filepath/path_windows_test.go
+++ b/src/path/filepath/path_windows_test.go
@@ -548,7 +548,7 @@ func TestIssue52476(t *testing.T) {
}{
{`..\.`, `C:`, `..\C:`},
{`..`, `C:`, `..\C:`},
- {`.`, `:`, `:`},
+ {`.`, `:`, `.\:`},
{`.`, `C:`, `.\C:`},
{`.`, `C:/a/b/../c`, `.\C:\a\c`},
{`.`, `\C:`, `.\C:`},