nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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