summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/grub/files/0010-gnulib-argp-help-Fix-dereference-of-a-possibly-NULL-.patch
diff options
context:
space:
mode:
authorMarta Rybczynska <rybczynska@gmail.com>2022-02-18 11:05:18 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-02 00:21:36 +0000
commitab977b3f498ecd0a0254de90f36bb00b98227929 (patch)
treee421139a9bf17552f1f6ee1c77edbfa1fcf7ef1a /meta/recipes-bsp/grub/files/0010-gnulib-argp-help-Fix-dereference-of-a-possibly-NULL-.patch
parente1122f6dadec3716da709fcc9a8f31f0bc3b933e (diff)
downloadpoky-ab977b3f498ecd0a0254de90f36bb00b98227929.tar.gz
grub: add a fix a NULL pointer dereference in gnulib
This change adds a fix for a NULL pointer dereference of state in gnulib. It is a part of a security series [1]. [1] https://lists.gnu.org/archive/html/grub-devel/2021-03/msg00007.html (From OE-Core rev: 37900e0b112bfd66ae61c03470fd32f77dee1aac) Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-bsp/grub/files/0010-gnulib-argp-help-Fix-dereference-of-a-possibly-NULL-.patch')
-rw-r--r--meta/recipes-bsp/grub/files/0010-gnulib-argp-help-Fix-dereference-of-a-possibly-NULL-.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0010-gnulib-argp-help-Fix-dereference-of-a-possibly-NULL-.patch b/meta/recipes-bsp/grub/files/0010-gnulib-argp-help-Fix-dereference-of-a-possibly-NULL-.patch
new file mode 100644
index 0000000000..102a494561
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/0010-gnulib-argp-help-Fix-dereference-of-a-possibly-NULL-.patch
@@ -0,0 +1,52 @@
1From eaf9da8b5f8349c51cfc89dd8e39a1a61f89790a Mon Sep 17 00:00:00 2001
2From: Darren Kenny <darren.kenny@oracle.com>
3Date: Wed, 28 Oct 2020 14:43:01 +0000
4Subject: [PATCH] gnulib/argp-help: Fix dereference of a possibly NULL state
5
6All other instances of call to __argp_failure() where there is
7a dgettext() call is first checking whether state is NULL before
8attempting to dereference it to get the root_argp->argp_domain.
9
10Fixes: CID 292436
11
12Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
13Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
14
15Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=3a37bf120a9194c373257c70175cdb5b337bc107]
16Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com>
17---
18 conf/Makefile.extra-dist | 1 +
19 .../lib/gnulib-patches/fix-null-state-deref.patch | 12 ++++++++++++
20 2 files changed, 13 insertions(+)
21 create mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch
22
23diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
24index 9e55458..96d7e69 100644
25--- a/conf/Makefile.extra-dist
26+++ b/conf/Makefile.extra-dist
27@@ -29,6 +29,7 @@ EXTRA_DIST += grub-core/genemuinit.sh
28 EXTRA_DIST += grub-core/genemuinitheader.sh
29
30 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
31+EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
32 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
33 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
34 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
35diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch
36new file mode 100644
37index 0000000..813ec09
38--- /dev/null
39+++ b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch
40@@ -0,0 +1,12 @@
41+--- a/lib/argp-help.c 2020-10-28 14:32:19.189215988 +0000
42++++ b/lib/argp-help.c 2020-10-28 14:38:21.204673940 +0000
43+@@ -145,7 +145,8 @@
44+ if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin)
45+ {
46+ __argp_failure (state, 0, 0,
47+- dgettext (state->root_argp->argp_domain,
48++ dgettext (state == NULL ? NULL
49++ : state->root_argp->argp_domain,
50+ "\
51+ ARGP_HELP_FMT: %s value is less than or equal to %s"),
52+ "rmargin", up->name);