From: longpanda <59477474+ventoy@users.noreply.github.com> Date: Sat, 6 Feb 2021 07:41:43 +0000 (+0800) Subject: fix integer overflow issue for i386-pc X-Git-Tag: v1.0.35~4 X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/commitdiff_plain/2185556dfd49db4160820fee86aac9dcae062a97?ds=sidebyside fix integer overflow issue for i386-pc --- diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c index 4c704ee..79e109d 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c @@ -553,7 +553,7 @@ static grub_err_t ventoy_cmd_mod(grub_extcmd_context_t ctxt, int argc, char **ar value1 = grub_strtoull(args[0], NULL, 10); value2 = grub_strtoull(args[1], NULL, 10); - grub_snprintf(buf, sizeof(buf), "%llu", (value1 % value2)); + grub_snprintf(buf, sizeof(buf), "%llu", (value1 & (value2 - 1))); grub_env_set(args[2], buf); VENTOY_CMD_RETURN(GRUB_ERR_NONE);