summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-1.14/0001-CVE-2022-32190.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/go/go-1.14/0001-CVE-2022-32190.patch')
-rw-r--r--meta/recipes-devtools/go/go-1.14/0001-CVE-2022-32190.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.14/0001-CVE-2022-32190.patch b/meta/recipes-devtools/go/go-1.14/0001-CVE-2022-32190.patch
new file mode 100644
index 0000000000..ad263b8023
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.14/0001-CVE-2022-32190.patch
@@ -0,0 +1,74 @@
1From 755f2dc35a19e6806de3ecbf836fa06ad875c67a Mon Sep 17 00:00:00 2001
2From: Carl Johnson <me@carlmjohnson.net>
3Date: Fri, 4 Mar 2022 14:49:52 +0000
4Subject: [PATCH 1/4] net/url: add JoinPath, URL.JoinPath
5
6Builds on CL 332209.
7
8Fixes #47005
9
10Change-Id: I82708dede05d79a196ca63f5a4e7cb5ac9a041ea
11GitHub-Last-Rev: 51b735066eef74f5e67c3e8899c58f44c0383c61
12GitHub-Pull-Request: golang/go#50383
13Reviewed-on: https://go-review.googlesource.com/c/go/+/374654
14Reviewed-by: Russ Cox <rsc@golang.org>
15Auto-Submit: Russ Cox <rsc@golang.org>
16Trust: Ian Lance Taylor <iant@golang.org>
17Reviewed-by: Damien Neil <dneil@google.com>
18Run-TryBot: Ian Lance Taylor <iant@golang.org>
19TryBot-Result: Gopher Robot <gobot@golang.org>
20
21Upstream-Status: Backport [https://github.com/golang/go/commit/604140d93111f89911e17cb147dcf6a02d2700d0]
22CVE: CVE-2022-32190
23Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
24---
25 src/net/url/url.go | 23 +++++++++++++++++++++++
26 1 file changed, 23 insertions(+)
27
28diff --git a/src/net/url/url.go b/src/net/url/url.go
29index 2880e82..dea8bfe 100644
30--- a/src/net/url/url.go
31+++ b/src/net/url/url.go
32@@ -13,6 +13,7 @@ package url
33 import (
34 "errors"
35 "fmt"
36+ "path"
37 "sort"
38 "strconv"
39 "strings"
40@@ -1104,6 +1105,17 @@ func (u *URL) UnmarshalBinary(text []byte) error {
41 return nil
42 }
43
44+// JoinPath returns a new URL with the provided path elements joined to
45+// any existing path and the resulting path cleaned of any ./ or ../ elements.
46+func (u *URL) JoinPath(elem ...string) *URL {
47+ url := *u
48+ if len(elem) > 0 {
49+ elem = append([]string{u.Path}, elem...)
50+ url.setPath(path.Join(elem...))
51+ }
52+ return &url
53+}
54+
55 // validUserinfo reports whether s is a valid userinfo string per RFC 3986
56 // Section 3.2.1:
57 // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
58@@ -1144,3 +1156,14 @@ func stringContainsCTLByte(s string) bool {
59 }
60 return false
61 }
62+
63+// JoinPath returns a URL string with the provided path elements joined to
64+// the existing path of base and the resulting path cleaned of any ./ or ../ elements.
65+func JoinPath(base string, elem ...string) (result string, err error) {
66+ url, err := Parse(base)
67+ if err != nil {
68+ return
69+ }
70+ result = url.JoinPath(elem...).String()
71+ return
72+}
73--
742.7.4