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

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