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