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

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