diff options
Diffstat (limited to 'meta/recipes-devtools/go/go-1.14/CVE-2022-41722-1.patch')
-rw-r--r-- | meta/recipes-devtools/go/go-1.14/CVE-2022-41722-1.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2022-41722-1.patch b/meta/recipes-devtools/go/go-1.14/CVE-2022-41722-1.patch new file mode 100644 index 0000000000..f5bffd7a0b --- /dev/null +++ b/meta/recipes-devtools/go/go-1.14/CVE-2022-41722-1.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 94e0c36694fb044e81381d112fef3692de7cdf52 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yasuhiro Matsumoto <mattn.jp@gmail.com> | ||
3 | Date: Fri, 22 Apr 2022 10:07:51 +0900 | ||
4 | Subject: [PATCH 1/2] path/filepath: do not remove prefix "." when following | ||
5 | path contains ":". | ||
6 | |||
7 | Fixes #52476 | ||
8 | |||
9 | Change-Id: I9eb72ac7dbccd6322d060291f31831dc389eb9bb | ||
10 | Reviewed-on: https://go-review.googlesource.com/c/go/+/401595 | ||
11 | Auto-Submit: Ian Lance Taylor <iant@google.com> | ||
12 | Reviewed-by: Alex Brainman <alex.brainman@gmail.com> | ||
13 | Run-TryBot: Ian Lance Taylor <iant@google.com> | ||
14 | Reviewed-by: Ian Lance Taylor <iant@google.com> | ||
15 | Reviewed-by: Damien Neil <dneil@google.com> | ||
16 | TryBot-Result: Gopher Robot <gobot@golang.org> | ||
17 | |||
18 | Upstream-Status: Backport from https://github.com/golang/go/commit/9cd1818a7d019c02fa4898b3e45a323e35033290 | ||
19 | CVE: CVE-2022-41722 | ||
20 | Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com> | ||
21 | --- | ||
22 | src/path/filepath/path.go | 14 +++++++++++++- | ||
23 | 1 file changed, 13 insertions(+), 1 deletion(-) | ||
24 | |||
25 | diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go | ||
26 | index 26f1833..92dc090 100644 | ||
27 | --- a/src/path/filepath/path.go | ||
28 | +++ b/src/path/filepath/path.go | ||
29 | @@ -116,9 +116,21 @@ func Clean(path string) string { | ||
30 | case os.IsPathSeparator(path[r]): | ||
31 | // empty path element | ||
32 | r++ | ||
33 | - case path[r] == '.' && (r+1 == n || os.IsPathSeparator(path[r+1])): | ||
34 | + case path[r] == '.' && r+1 == n: | ||
35 | // . element | ||
36 | r++ | ||
37 | + case path[r] == '.' && os.IsPathSeparator(path[r+1]): | ||
38 | + // ./ element | ||
39 | + r++ | ||
40 | + | ||
41 | + for r < len(path) && os.IsPathSeparator(path[r]) { | ||
42 | + r++ | ||
43 | + } | ||
44 | + if out.w == 0 && volumeNameLen(path[r:]) > 0 { | ||
45 | + // When joining prefix "." and an absolute path on Windows, | ||
46 | + // the prefix should not be removed. | ||
47 | + out.append('.') | ||
48 | + } | ||
49 | case path[r] == '.' && path[r+1] == '.' && (r+2 == n || os.IsPathSeparator(path[r+2])): | ||
50 | // .. element: remove to last separator | ||
51 | r += 2 | ||
52 | -- | ||
53 | 2.7.4 | ||