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

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