mirror of
https://git.yoctoproject.org/poky
synced 2026-09-29 07:36:20 +02:00
Backport fixes for: * CVE-2020-27749 - Upstream-Status: Backport from https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=c6c426e5ab6ea715153b72584de6bd8c82f698ec && https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=b1c9e9e889e4273fb15712051c887e6078511448 && https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=3d157bbd06506b170fde5ec23980c4bf9f7660e2 && https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=8bc817014ce3d7a498db44eae33c8b90e2430926 && https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=030fb6c4fa354cdbd6a8d6903dfed5d36eaf3cb2 && https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=4ea7bae51f97e49c84dc67ea30b466ca8633b9f6 * CVE-2021-20225 - Upstream-Status: Backport from https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=2a330dba93ff11bc00eda76e9419bc52b0c7ead6 * CVE-2021-20233 - Upstream-Status: Backport from https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=2f533a89a8dfcacbf2c9dbc77d910f111f24bf33 (From OE-Core rev: 636aab87bc7e10b4ce0bdaa00dd01416a590a801) Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
59 lines
1.8 KiB
Diff
59 lines
1.8 KiB
Diff
From 2a330dba93ff11bc00eda76e9419bc52b0c7ead6 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Axtens <dja@axtens.net>
|
|
Date: Fri, 22 Jan 2021 16:07:29 +1100
|
|
Subject: lib/arg: Block repeated short options that require an argument
|
|
|
|
Fuzzing found the following crash:
|
|
|
|
search -hhhhhhhhhhhhhf
|
|
|
|
We didn't allocate enough option space for 13 hints because the
|
|
allocation code counts the number of discrete arguments (i.e. argc).
|
|
However, the shortopt parsing code will happily keep processing
|
|
a combination of short options without checking if those short
|
|
options require an argument. This means you can easily end writing
|
|
past the allocated option space.
|
|
|
|
This fixes a OOB write which can cause heap corruption.
|
|
|
|
Fixes: CVE-2021-20225
|
|
|
|
Reported-by: Daniel Axtens <dja@axtens.net>
|
|
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
|
|
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=2a330dba93ff11bc00eda76e9419bc52b0c7ead6]
|
|
CVE: CVE-2021-20225
|
|
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
|
---
|
|
grub-core/lib/arg.c | 13 +++++++++++++
|
|
1 file changed, 13 insertions(+)
|
|
|
|
diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c
|
|
index 3288609..537c5e9 100644
|
|
--- a/grub-core/lib/arg.c
|
|
+++ b/grub-core/lib/arg.c
|
|
@@ -299,6 +299,19 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|
it can have an argument value. */
|
|
if (*curshort)
|
|
{
|
|
+ /*
|
|
+ * Only permit further short opts if this one doesn't
|
|
+ * require a value.
|
|
+ */
|
|
+ if (opt->type != ARG_TYPE_NONE &&
|
|
+ !(opt->flags & GRUB_ARG_OPTION_OPTIONAL))
|
|
+ {
|
|
+ grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
+ N_("missing mandatory option for `%s'"),
|
|
+ opt->longarg);
|
|
+ goto fail;
|
|
+ }
|
|
+
|
|
if (parse_option (cmd, opt, 0, usr) || grub_errno)
|
|
goto fail;
|
|
}
|
|
--
|
|
2.25.1
|
|
|