You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.9 KiB
65 lines
2.9 KiB
8 months ago
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Darren Kenny <darren.kenny@oracle.com>
|
||
|
Date: Wed, 28 Oct 2020 14:43:01 +0000
|
||
|
Subject: [PATCH] gnulib/argp-help: Fix dereference of a possibly NULL state
|
||
|
|
||
|
All other instances of call to __argp_failure() where there is
|
||
|
a dgettext() call is first checking whether state is NULL before
|
||
|
attempting to dereference it to get the root_argp->argp_domain.
|
||
|
|
||
|
Fixes: CID 292436
|
||
|
|
||
|
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||
|
---
|
||
|
grub-core/gnulib/argp-help.c | 3 ++-
|
||
|
conf/Makefile.extra-dist | 1 +
|
||
|
grub-core/gnulib-fix-null-state-deref.patch | 12 ++++++++++++
|
||
|
3 files changed, 15 insertions(+), 1 deletion(-)
|
||
|
create mode 100644 grub-core/gnulib-fix-null-state-deref.patch
|
||
|
|
||
|
diff --git a/grub-core/gnulib/argp-help.c b/grub-core/gnulib/argp-help.c
|
||
|
index b9be63f40..8af8be073 100644
|
||
|
--- a/grub-core/gnulib/argp-help.c
|
||
|
+++ b/grub-core/gnulib/argp-help.c
|
||
|
@@ -145,7 +145,8 @@ validate_uparams (const struct argp_state *state, struct uparams *upptr)
|
||
|
if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin)
|
||
|
{
|
||
|
__argp_failure (state, 0, 0,
|
||
|
- dgettext (state->root_argp->argp_domain,
|
||
|
+ dgettext (state == NULL ? NULL
|
||
|
+ : state->root_argp->argp_domain,
|
||
|
"\
|
||
|
ARGP_HELP_FMT: %s value is less than or equal to %s"),
|
||
|
"rmargin", up->name);
|
||
|
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
|
||
|
index 883baba56..06606de8d 100644
|
||
|
--- a/conf/Makefile.extra-dist
|
||
|
+++ b/conf/Makefile.extra-dist
|
||
|
@@ -31,6 +31,7 @@ EXTRA_DIST += grub-core/genemuinit.sh
|
||
|
EXTRA_DIST += grub-core/genemuinitheader.sh
|
||
|
|
||
|
EXTRA_DIST += grub-core/gnulib-fix-null-deref.diff
|
||
|
+EXTRA_DIST += grub-core/gnulib-fix-null-state-deref.patch
|
||
|
EXTRA_DIST += grub-core/gnulib-fix-uninit-structure.patch
|
||
|
EXTRA_DIST += grub-core/gnulib-fix-unused-value.patch
|
||
|
EXTRA_DIST += grub-core/gnulib-fix-width.diff
|
||
|
diff --git a/grub-core/gnulib-fix-null-state-deref.patch b/grub-core/gnulib-fix-null-state-deref.patch
|
||
|
new file mode 100644
|
||
|
index 000000000..813ec09c8
|
||
|
--- /dev/null
|
||
|
+++ b/grub-core/gnulib-fix-null-state-deref.patch
|
||
|
@@ -0,0 +1,12 @@
|
||
|
+--- a/lib/argp-help.c 2020-10-28 14:32:19.189215988 +0000
|
||
|
++++ b/lib/argp-help.c 2020-10-28 14:38:21.204673940 +0000
|
||
|
+@@ -145,7 +145,8 @@
|
||
|
+ if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin)
|
||
|
+ {
|
||
|
+ __argp_failure (state, 0, 0,
|
||
|
+- dgettext (state->root_argp->argp_domain,
|
||
|
++ dgettext (state == NULL ? NULL
|
||
|
++ : state->root_argp->argp_domain,
|
||
|
+ "\
|
||
|
+ ARGP_HELP_FMT: %s value is less than or equal to %s"),
|
||
|
+ "rmargin", up->name);
|