fix integer overflow issue for i386-pc

This commit is contained in:
longpanda 2021-02-06 14:37:04 +08:00 committed by GitHub
parent 3dd3b7d26f
commit 97be7b8bfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -541,8 +541,8 @@ static grub_err_t ventoy_cmd_incr(grub_extcmd_context_t ctxt, int argc, char **a
static grub_err_t ventoy_cmd_mod(grub_extcmd_context_t ctxt, int argc, char **args)
{
long value1 = 0;
long value2 = 0;
ulonglong value1 = 0;
ulonglong value2 = 0;
char buf[32];
if (argc != 3)
@ -550,10 +550,10 @@ static grub_err_t ventoy_cmd_mod(grub_extcmd_context_t ctxt, int argc, char **ar
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s {Int} {Int} {Variable}", cmd_raw_name);
}
value1 = grub_strtol(args[0], NULL, 10);
value2 = grub_strtol(args[1], NULL, 10);
value1 = grub_strtoull(args[0], NULL, 10);
value2 = grub_strtoull(args[1], NULL, 10);
grub_snprintf(buf, sizeof(buf), "%ld", (value1 % value2));
grub_snprintf(buf, sizeof(buf), "%llu", (value1 % value2));
grub_env_set(args[2], buf);
VENTOY_CMD_RETURN(GRUB_ERR_NONE);