From: Avnish Chouhan Date: Mon, 10 Nov 2025 14:57:20 +0000 (+0530) Subject: script/execute: Add missing grub_strdup() failure check X-Git-Tag: grub-2.14~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9eebd67744a472a8b1885ecc8a0518fb1632ef12;p=thirdparty%2Fgrub.git script/execute: Add missing grub_strdup() failure check If grub_strdup() fails, it returns NULL and passing NULL further down to the code can lead to segmentation fault or an undefined behavior. Signed-off-by: Avnish Chouhan Reviewed-by: Sudhakar Kuppusamy Reviewed-by: Daniel Kiper --- diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c index da99dfa05..62afcdc99 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -1015,6 +1015,9 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd) { /* As a last resort, try if it is an assignment. */ char *assign = grub_strdup (cmdname); + if (assign == NULL) + return grub_errno; + char *eq = grub_strchr (assign, '='); if (eq)