]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.19] path/filepath: do not Clean("a/../c:/b") into c:\b on Windows
authorDamien Neil <dneil@google.com>
Tue, 13 Dec 2022 00:43:37 +0000 (16:43 -0800)
committerMichael Pratt <mpratt@google.com>
Tue, 14 Feb 2023 17:25:26 +0000 (17:25 +0000)
commit3345ddca41f00f9ed6fc3c1a36f6e2bede02d7ff
treee76136b3f00e9f33a2d86312f14a1b970e417649
parentf69dbb6dfa8af7a32a47070d71b82fc4ed4b9d2a
[release-branch.go1.19] 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.

Updates #57274
Fixes #57275
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>
(cherry picked from commit 780dfa043ff5192c37de0d6fd1053a66b2b9f378)
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1728206
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/468115
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Bypass: Michael Pratt <mpratt@google.com>
src/path/filepath/path.go
src/path/filepath/path_test.go
src/path/filepath/path_windows_test.go