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 <avnish@linux.ibm.com> Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
f0170c2177
commit
9eebd67744
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user