diff options
Diffstat (limited to 'meta/recipes-bsp/grub/files/0027-libgcrypt-mpi-Fix-possible-NULL-dereference.patch')
-rw-r--r-- | meta/recipes-bsp/grub/files/0027-libgcrypt-mpi-Fix-possible-NULL-dereference.patch | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0027-libgcrypt-mpi-Fix-possible-NULL-dereference.patch b/meta/recipes-bsp/grub/files/0027-libgcrypt-mpi-Fix-possible-NULL-dereference.patch new file mode 100644 index 0000000000..08299d021e --- /dev/null +++ b/meta/recipes-bsp/grub/files/0027-libgcrypt-mpi-Fix-possible-NULL-dereference.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From d26c8771293637b0465f2cb67d97cb58bacc62da Mon Sep 17 00:00:00 2001 | ||
2 | From: Darren Kenny <darren.kenny@oracle.com> | ||
3 | Date: Thu, 26 Nov 2020 10:41:54 +0000 | ||
4 | Subject: [PATCH] libgcrypt/mpi: Fix possible NULL dereference | ||
5 | |||
6 | The code in gcry_mpi_scan() assumes that buffer is not NULL, but there | ||
7 | is no explicit check for that, so we add one. | ||
8 | |||
9 | Fixes: CID 73757 | ||
10 | |||
11 | Signed-off-by: Darren Kenny <darren.kenny@oracle.com> | ||
12 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
13 | |||
14 | Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=ae0f3fabeba7b393113d5dc185b6aff9b728136d] | ||
15 | Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> | ||
16 | --- | ||
17 | grub-core/lib/libgcrypt/mpi/mpicoder.c | 3 +++ | ||
18 | 1 file changed, 3 insertions(+) | ||
19 | |||
20 | diff --git a/grub-core/lib/libgcrypt/mpi/mpicoder.c b/grub-core/lib/libgcrypt/mpi/mpicoder.c | ||
21 | index 7ecad27..6fe3891 100644 | ||
22 | --- a/grub-core/lib/libgcrypt/mpi/mpicoder.c | ||
23 | +++ b/grub-core/lib/libgcrypt/mpi/mpicoder.c | ||
24 | @@ -379,6 +379,9 @@ gcry_mpi_scan (struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, | ||
25 | unsigned int len; | ||
26 | int secure = (buffer && gcry_is_secure (buffer)); | ||
27 | |||
28 | + if (!buffer) | ||
29 | + return gcry_error (GPG_ERR_INV_ARG); | ||
30 | + | ||
31 | if (format == GCRYMPI_FMT_SSH) | ||
32 | len = 0; | ||
33 | else | ||