Blame SOURCES/0411-libgcrypt-mpi-Fix-possible-NULL-dereference.patch

468bd4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
468bd4
From: Darren Kenny <darren.kenny@oracle.com>
468bd4
Date: Thu, 26 Nov 2020 10:41:54 +0000
468bd4
Subject: [PATCH] libgcrypt/mpi: Fix possible NULL dereference
468bd4
468bd4
The code in gcry_mpi_scan() assumes that buffer is not NULL, but there
468bd4
is no explicit check for that, so we add one.
468bd4
468bd4
Fixes: CID 73757
468bd4
468bd4
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
468bd4
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
468bd4
---
468bd4
 grub-core/lib/libgcrypt/mpi/mpicoder.c | 3 +++
468bd4
 1 file changed, 3 insertions(+)
468bd4
468bd4
diff --git a/grub-core/lib/libgcrypt/mpi/mpicoder.c b/grub-core/lib/libgcrypt/mpi/mpicoder.c
09e3cc
index 7ecad27b2..6fe389165 100644
468bd4
--- a/grub-core/lib/libgcrypt/mpi/mpicoder.c
468bd4
+++ b/grub-core/lib/libgcrypt/mpi/mpicoder.c
468bd4
@@ -379,6 +379,9 @@ gcry_mpi_scan (struct gcry_mpi **ret_mpi, enum gcry_mpi_format format,
468bd4
   unsigned int len;
468bd4
   int secure = (buffer && gcry_is_secure (buffer));
468bd4
 
468bd4
+  if (!buffer)
468bd4
+    return gcry_error (GPG_ERR_INV_ARG);
468bd4
+
468bd4
   if (format == GCRYMPI_FMT_SSH)
468bd4
     len = 0;
468bd4
   else