Skip to content

Commit

Permalink
Fixed custom varstore bug
Browse files Browse the repository at this point in the history
  • Loading branch information
datasone committed Mar 25, 2021
1 parent a48527d commit f064a3e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions setup_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ grub_cmd_setup_var (grub_command_t cmd,
grub_uint16_t isMode3 = 0;
grub_uint16_t isModeVS = 0;
grub_uint16_t isModeCV = 0;
if (cmd->name[CMDCHECK_SETUP_VAR2] != 0) isMode2 = 1;
if (cmd->name[CMDCHECK_SETUP_VAR2] == '2') isMode2 = 1;
if (grub_strlen(cmd->name) > CMDCHECK_SETUP_DVARS_START_INDEX && cmd->name[CMDCHECK_SETUP_DVARS_START_INDEX] != 0)
{
char name_suffix[11];
Expand Down Expand Up @@ -201,9 +201,11 @@ grub_cmd_setup_var (grub_command_t cmd,
grub_printf("status: 0x%02x\n", (grub_uint32_t) status);
}

if(! status && ((name_size == INSYDE_SETUP_VAR_NSIZE && 0 == grub_memcmp(name, INSYDE_SETUP_VAR, name_size)) ||
(isMode2 && name_size == INSYDE_CUSTOM_VAR_NSIZE && 0 == grub_memcmp(name, INSYDE_CUSTOM_VAR, name_size)) ||
(isModeCV && name_size == custom_varname_size && 0 == grub_memcmp(name, custom_varname, name_size))))
if(! status && (
(!isModeCV && name_size == INSYDE_SETUP_VAR_NSIZE && 0 == grub_memcmp(name, INSYDE_SETUP_VAR, name_size)) ||
(isMode2 && name_size == INSYDE_CUSTOM_VAR_NSIZE && 0 == grub_memcmp(name, INSYDE_CUSTOM_VAR, name_size)) ||
(isModeCV && name_size == custom_varname_size && 0 == grub_memcmp(name, custom_varname, name_size))
))
{
grub_printf("var name: ");
print_varname(name);
Expand Down

0 comments on commit f064a3e

Please sign in to comment.