]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
golang: CVE-2022-27664 net/http: handle server errors after sending GOAWAY
authorHitendra Prajapati <hprajapati@mvista.com>
Thu, 29 Sep 2022 12:39:36 +0000 (18:09 +0530)
committerSteve Sakoman <steve@sakoman.com>
Thu, 29 Sep 2022 16:45:30 +0000 (06:45 -1000)
Source: https://github.com/golang/go
MR: 121912
Type: Security Fix
Disposition: Backport from https://github.com/golang/go/commit/5bc9106458fc07851ac324a4157132a91b1f3479
ChangeID: 0b76a92a774279d7bffc9d6fa05564dfd8371e8c
Description:
 CVE-2022-27664 golang: net/http: handle server errors after sending GOAWAY.

Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-devtools/go/go-1.14.inc
meta/recipes-devtools/go/go-1.14/CVE-2022-27664.patch [new file with mode: 0644]

index af6345205e7980c7a83cf06228da3287b7d1db10..540ea4e62d08a8ec91b1a1f408987d12a4cb4374 100644 (file)
@@ -36,6 +36,7 @@ SRC_URI += "\
     file://CVE-2021-36221.patch \
     file://CVE-2021-39293.patch \
     file://CVE-2021-41771.patch \
+    file://CVE-2022-27664.patch \
 "
 
 SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2022-27664.patch b/meta/recipes-devtools/go/go-1.14/CVE-2022-27664.patch
new file mode 100644 (file)
index 0000000..238c3ea
--- /dev/null
@@ -0,0 +1,68 @@
+From 48c9076dcfc2dc894842ff758c8cfae7957c9565 Mon Sep 17 00:00:00 2001
+From: Hitendra Prajapati <hprajapati@mvista.com>
+Date: Thu, 29 Sep 2022 17:06:18 +0530
+Subject: [PATCH] CVE-2022-27664
+
+Upstream-Status: Backport [https://github.com/golang/go/commit/5bc9106458fc07851ac324a4157132a91b1f3479]
+CVE: CVE-2022-27664
+Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
+---
+ src/net/http/h2_bundle.go | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
+index 65d851d..83f2a72 100644
+--- a/src/net/http/h2_bundle.go
++++ b/src/net/http/h2_bundle.go
+@@ -3254,10 +3254,11 @@ var (
+ // name (key). See httpguts.ValidHeaderName for the base rules.
+ //
+ // Further, http2 says:
+-//   "Just as in HTTP/1.x, header field names are strings of ASCII
+-//   characters that are compared in a case-insensitive
+-//   fashion. However, header field names MUST be converted to
+-//   lowercase prior to their encoding in HTTP/2. "
++//
++//    "Just as in HTTP/1.x, header field names are strings of ASCII
++//    characters that are compared in a case-insensitive
++//    fashion. However, header field names MUST be converted to
++//    lowercase prior to their encoding in HTTP/2. "
+ func http2validWireHeaderFieldName(v string) bool {
+       if len(v) == 0 {
+               return false
+@@ -3446,8 +3447,8 @@ func (s *http2sorter) SortStrings(ss []string) {
+ // validPseudoPath reports whether v is a valid :path pseudo-header
+ // value. It must be either:
+ //
+-//     *) a non-empty string starting with '/'
+-//     *) the string '*', for OPTIONS requests.
++//    *) a non-empty string starting with '/'
++//    *) the string '*', for OPTIONS requests.
+ //
+ // For now this is only used a quick check for deciding when to clean
+ // up Opaque URLs before sending requests from the Transport.
+@@ -4897,6 +4898,9 @@ func (sc *http2serverConn) startGracefulShutdownInternal() {
+ func (sc *http2serverConn) goAway(code http2ErrCode) {
+       sc.serveG.check()
+       if sc.inGoAway {
++              if sc.goAwayCode == http2ErrCodeNo {
++                      sc.goAwayCode = code
++              }
+               return
+       }
+       sc.inGoAway = true
+@@ -6091,8 +6095,9 @@ func (rws *http2responseWriterState) writeChunk(p []byte) (n int, err error) {
+ // prior to the headers being written. If the set of trailers is fixed
+ // or known before the header is written, the normal Go trailers mechanism
+ // is preferred:
+-//    https://golang.org/pkg/net/http/#ResponseWriter
+-//    https://golang.org/pkg/net/http/#example_ResponseWriter_trailers
++//
++//    https://golang.org/pkg/net/http/#ResponseWriter
++//    https://golang.org/pkg/net/http/#example_ResponseWriter_trailers
+ const http2TrailerPrefix = "Trailer:"
+ // promoteUndeclaredTrailers permits http.Handlers to set trailers
+-- 
+2.25.1
+