summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/grub/files/CVE-2022-28734-net-http-Fix-OOB-write-for-split-http-headers.patch
diff options
context:
space:
mode:
authorYongxin Liu <yongxin.liu@windriver.com>2022-08-05 10:42:19 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-21 22:51:41 +0100
commitd4b6ad56b707fc7a53fc424bea00383a4d4fa9f1 (patch)
tree23b07b32f92d7d7d8d353b36bc4e7fc777b095a3 /meta/recipes-bsp/grub/files/CVE-2022-28734-net-http-Fix-OOB-write-for-split-http-headers.patch
parent0081575ff9b3627c6d2fdee4bf88ea6cb87feb09 (diff)
downloadpoky-d4b6ad56b707fc7a53fc424bea00383a4d4fa9f1.tar.gz
grub2: fix several CVEs
Backport CVE patches from upstream to fix: CVE-2021-3695 CVE-2021-3696 CVE-2021-3697 CVE-2022-28733 CVE-2022-28734 CVE-2022-28735 Backport the following 5 patches to make CVE patches be applied smoothly. video-Remove-trailing-whitespaces.patch video-readers-jpeg-Abort-sooner-if-a-read-operation-.patch video-readers-jpeg-Refuse-to-handle-multiple-start-o.patch (From OE-Core rev: db43401a3a4c201f02f4128fa4bac8ce993bfec0) Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-bsp/grub/files/CVE-2022-28734-net-http-Fix-OOB-write-for-split-http-headers.patch')
-rw-r--r--meta/recipes-bsp/grub/files/CVE-2022-28734-net-http-Fix-OOB-write-for-split-http-headers.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/CVE-2022-28734-net-http-Fix-OOB-write-for-split-http-headers.patch b/meta/recipes-bsp/grub/files/CVE-2022-28734-net-http-Fix-OOB-write-for-split-http-headers.patch
new file mode 100644
index 0000000000..e0ca1eec44
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/CVE-2022-28734-net-http-Fix-OOB-write-for-split-http-headers.patch
@@ -0,0 +1,56 @@
1From ec6bfd3237394c1c7dbf2fd73417173318d22f4b Mon Sep 17 00:00:00 2001
2From: Daniel Axtens <dja@axtens.net>
3Date: Tue, 8 Mar 2022 18:17:03 +1100
4Subject: [PATCH] net/http: Fix OOB write for split http headers
5
6GRUB has special code for handling an http header that is split
7across two packets.
8
9The code tracks the end of line by looking for a "\n" byte. The
10code for split headers has always advanced the pointer just past the
11end of the line, whereas the code that handles unsplit headers does
12not advance the pointer. This extra advance causes the length to be
13one greater, which breaks an assumption in parse_line(), leading to
14it writing a NUL byte one byte past the end of the buffer where we
15reconstruct the line from the two packets.
16
17It's conceivable that an attacker controlled set of packets could
18cause this to zero out the first byte of the "next" pointer of the
19grub_mm_region structure following the current_line buffer.
20
21Do not advance the pointer in the split header case.
22
23Fixes: CVE-2022-28734
24
25Signed-off-by: Daniel Axtens <dja@axtens.net>
26Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
27
28Upstream-Status: Backport
29CVE: CVE-2022-28734
30
31Reference to upstream patch:
32https://git.savannah.gnu.org/cgit/grub.git/commit/?id=ec6bfd3237394c1c7dbf2fd73417173318d22f4b
33
34Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
35---
36 grub-core/net/http.c | 4 +---
37 1 file changed, 1 insertion(+), 3 deletions(-)
38
39diff --git a/grub-core/net/http.c b/grub-core/net/http.c
40index f8d7bf0cd..33a0a28c4 100644
41--- a/grub-core/net/http.c
42+++ b/grub-core/net/http.c
43@@ -190,9 +190,7 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)),
44 int have_line = 1;
45 char *t;
46 ptr = grub_memchr (nb->data, '\n', nb->tail - nb->data);
47- if (ptr)
48- ptr++;
49- else
50+ if (ptr == NULL)
51 {
52 have_line = 0;
53 ptr = (char *) nb->tail;
54--
552.34.1
56