From eaf9da8b5f8349c51cfc89dd8e39a1a61f89790a Mon Sep 17 00:00:00 2001 From: Darren Kenny 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 Reviewed-by: Daniel Kiper Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=3a37bf120a9194c373257c70175cdb5b337bc107] Signed-off-by: Marta Rybczynska --- conf/Makefile.extra-dist | 1 + .../lib/gnulib-patches/fix-null-state-deref.patch | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 grub-core/lib/gnulib-patches/fix-null-state-deref.patch diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist index 9e55458..96d7e69 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -29,6 +29,7 @@ EXTRA_DIST += grub-core/genemuinit.sh 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-uninit-structure.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch new file mode 100644 index 0000000..813ec09 --- /dev/null +++ b/grub-core/lib/gnulib-patches/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);