xref: /OK3568_Linux_fs/buildroot/boot/grub2/0059-gnulib-regcomp-Fix-uninitialized-re_token.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 03477085f9a33789ba6cca7cd49ab9326a1baa0e Mon Sep 17 00:00:00 2001
2From: Darren Kenny <darren.kenny@oracle.com>
3Date: Tue, 24 Nov 2020 18:04:22 +0000
4Subject: [PATCH] gnulib/regcomp: Fix uninitialized re_token
5
6This issue has been fixed in the latest version of gnulib, so to
7maintain consistency, I've backported that change rather than doing
8something different.
9
10Fixes: CID 73828
11
12Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
13Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
14[Add changes to generated files]
15Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
16---
17 Makefile.in                                               |  1 +
18 conf/Makefile.extra-dist                                  |  1 +
19 .../lib/gnulib-patches/fix-regcomp-uninit-token.patch     | 15 +++++++++++++++
20 grub-core/lib/gnulib/regcomp.c                            |  6 +-----
21 4 files changed, 18 insertions(+), 5 deletions(-)
22 create mode 100644 grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
23
24diff --git a/Makefile.in b/Makefile.in
25index d9da6e9..9442504 100644
26--- a/Makefile.in
27+++ b/Makefile.in
28@@ -2743,6 +2743,7 @@ EXTRA_DIST = autogen.sh geninit.sh gentpl.py Makefile.util.def \
29 	grub-core/genemuinit.sh grub-core/genemuinitheader.sh \
30 	grub-core/lib/gnulib-patches/fix-null-deref.patch \
31 	grub-core/lib/gnulib-patches/fix-null-state-deref.patch \
32+	grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch \
33 	grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch \
34 	grub-core/lib/gnulib-patches/fix-uninit-structure.patch \
35 	grub-core/lib/gnulib-patches/fix-unused-value.patch \
36diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
37index d27d3a9..ffe6829 100644
38--- a/conf/Makefile.extra-dist
39+++ b/conf/Makefile.extra-dist
40@@ -30,6 +30,7 @@ EXTRA_DIST += grub-core/genemuinitheader.sh
41
42 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
43 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-state-deref.patch
44+EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
45 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch
46 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
47 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
48diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
49new file mode 100644
50index 0000000..02e0631
51--- /dev/null
52+++ b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch
53@@ -0,0 +1,15 @@
54+--- a/lib/regcomp.c	2020-11-24 17:06:08.159223858 +0000
55++++ b/lib/regcomp.c	2020-11-24 17:06:15.630253923 +0000
56+@@ -3808,11 +3808,7 @@
57+ create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
58+ 	     re_token_type_t type)
59+ {
60+-  re_token_t t;
61+-#if defined GCC_LINT || defined lint
62+-  memset (&t, 0, sizeof t);
63+-#endif
64+-  t.type = type;
65++  re_token_t t = { .type = type };
66+   return create_token_tree (dfa, left, right, &t);
67+ }
68+
69diff --git a/grub-core/lib/gnulib/regcomp.c b/grub-core/lib/gnulib/regcomp.c
70index 2545d3e..64a4fa7 100644
71--- a/grub-core/lib/gnulib/regcomp.c
72+++ b/grub-core/lib/gnulib/regcomp.c
73@@ -3808,11 +3808,7 @@ static bin_tree_t *
74 create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
75 	     re_token_type_t type)
76 {
77-  re_token_t t;
78-#if defined GCC_LINT || defined lint
79-  memset (&t, 0, sizeof t);
80-#endif
81-  t.type = type;
82+  re_token_t t = { .type = type };
83   return create_token_tree (dfa, left, right, &t);
84 }
85
86--
872.14.2
88
89