nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0424-loader-xnu-Check-if-pointer-is-NULL-before-using-it.patch

80913e
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
80913e
From: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>
80913e
Date: Mon, 30 Nov 2020 10:36:00 -0300
80913e
Subject: [PATCH] loader/xnu: Check if pointer is NULL before using it
80913e
80913e
Fixes: CID 73654
80913e
80913e
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>
80913e
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
80913e
---
80913e
 grub-core/loader/xnu.c | 8 ++++----
80913e
 1 file changed, 4 insertions(+), 4 deletions(-)
80913e
80913e
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
80913e
index af885a648c6..49641b8bbc2 100644
80913e
--- a/grub-core/loader/xnu.c
80913e
+++ b/grub-core/loader/xnu.c
80913e
@@ -671,6 +671,9 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile,
80913e
   char *name, *nameend;
80913e
   int namelen;
80913e
 
80913e
+  if (infoplistname == NULL)
80913e
+    return grub_error (GRUB_ERR_BAD_FILENAME, N_("missing p-list filename"));
80913e
+
80913e
   name = get_name_ptr (infoplistname);
80913e
   nameend = grub_strchr (name, '/');
80913e
 
80913e
@@ -702,10 +705,7 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile,
80913e
   else
80913e
     macho = 0;
80913e
 
80913e
-  if (infoplistname)
80913e
-    infoplist = grub_file_open (infoplistname, GRUB_FILE_TYPE_XNU_INFO_PLIST);
80913e
-  else
80913e
-    infoplist = 0;
80913e
+  infoplist = grub_file_open (infoplistname, GRUB_FILE_TYPE_XNU_INFO_PLIST);
80913e
   grub_errno = GRUB_ERR_NONE;
80913e
   if (infoplist)
80913e
     {