[PATCH 3/4] kern/mips/arc: add missing grub_strdup failure check

Avnish Chouhan <[email protected]>
Newsgroups org.gnu.grub-devel
Message-ID <[email protected]>
Adding a failure check in grub_strdup. If grub_strdup() fails,
it returns NULL and can lead to segmentation faults or undefined behavior.

Signed-off-by: Avnish Chouhan <[email protected]>
---
 grub-core/kern/mips/arc/init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c
index 2ed3ff3..2b76988 100644
--- a/grub-core/kern/mips/arc/init.c
+++ b/grub-core/kern/mips/arc/init.c
@@ -403,6 +403,9 @@ grub_machine_get_bootlocation (char **device, char **path)
       if (!syspart)
 	return;
       loaddev = grub_strdup (syspart);
+      if (loaddev == NULL)
+        return;
+
     }
 
   partptr = get_part (loaddev);
-- 
2.47.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.