diff options
Diffstat (limited to 'meta/recipes-devtools/go/go-1.14/0002-CVE-2022-32190.patch')
-rw-r--r-- | meta/recipes-devtools/go/go-1.14/0002-CVE-2022-32190.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.14/0002-CVE-2022-32190.patch b/meta/recipes-devtools/go/go-1.14/0002-CVE-2022-32190.patch new file mode 100644 index 0000000000..1a11cc72bc --- /dev/null +++ b/meta/recipes-devtools/go/go-1.14/0002-CVE-2022-32190.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From 985108de87e7d2ecb2b28cb53b323d530387b884 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ian Lance Taylor <iant@golang.org> | ||
3 | Date: Thu, 31 Mar 2022 13:21:39 -0700 | ||
4 | Subject: [PATCH 2/4] net/url: preserve a trailing slash in JoinPath | ||
5 | |||
6 | Fixes #52074 | ||
7 | |||
8 | Change-Id: I30897f32e70a6ca0c4e11aaf07088c27336efaba | ||
9 | Reviewed-on: https://go-review.googlesource.com/c/go/+/397256 | ||
10 | Trust: Ian Lance Taylor <iant@golang.org> | ||
11 | Run-TryBot: Ian Lance Taylor <iant@golang.org> | ||
12 | TryBot-Result: Gopher Robot <gobot@golang.org> | ||
13 | Reviewed-by: Matt Layher <mdlayher@gmail.com> | ||
14 | Trust: Matt Layher <mdlayher@gmail.com> | ||
15 | |||
16 | Upstream-Status: Backport [https://github.com/golang/go/commit/dbb52cc9f3e83a3040f46c2ae7650c15ab342179] | ||
17 | CVE: CVE-2022-32190 | ||
18 | Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com> | ||
19 | --- | ||
20 | src/net/url/url.go | 9 ++++++++- | ||
21 | 1 file changed, 8 insertions(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/src/net/url/url.go b/src/net/url/url.go | ||
24 | index dea8bfe..3436707 100644 | ||
25 | --- a/src/net/url/url.go | ||
26 | +++ b/src/net/url/url.go | ||
27 | @@ -1107,11 +1107,18 @@ func (u *URL) UnmarshalBinary(text []byte) error { | ||
28 | |||
29 | // JoinPath returns a new URL with the provided path elements joined to | ||
30 | // any existing path and the resulting path cleaned of any ./ or ../ elements. | ||
31 | +// Any sequences of multiple / characters will be reduced to a single /. | ||
32 | func (u *URL) JoinPath(elem ...string) *URL { | ||
33 | url := *u | ||
34 | if len(elem) > 0 { | ||
35 | elem = append([]string{u.Path}, elem...) | ||
36 | - url.setPath(path.Join(elem...)) | ||
37 | + p := path.Join(elem...) | ||
38 | + // path.Join will remove any trailing slashes. | ||
39 | + // Preserve at least one. | ||
40 | + if strings.HasSuffix(elem[len(elem)-1], "/") && !strings.HasSuffix(p, "/") { | ||
41 | + p += "/" | ||
42 | + } | ||
43 | + url.setPath(p) | ||
44 | } | ||
45 | return &url | ||
46 | } | ||
47 | -- | ||
48 | 2.7.4 | ||