diff --git a/ChangeLog b/ChangeLog index feeea672c..7355a4550 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-02-10 Vladimir Serbinenko + + * grub-core/commands/legacycfg.c (grub_cmd_legacy_kernel): + Avoid improper use of strings. + (grub_cmd_legacy_initrdnounzip): Likewise. + 2012-02-10 Vladimir Serbinenko * include/grub/emu/misc.h (grub_util_warn): Add missing format diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c index f4939a996..f33abeac5 100644 --- a/grub-core/commands/legacycfg.c +++ b/grub-core/commands/legacycfg.c @@ -411,10 +411,11 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)), } else { + char rbuf[3] = "-r"; bsdargc = cutargc + 2; bsdargs = grub_malloc (sizeof (bsdargs[0]) * bsdargc); grub_memcpy (bsdargs, args, argc * sizeof (bsdargs[0])); - bsdargs[argc] = "-r"; + bsdargs[argc] = rbuf; bsdargs[argc + 1] = bsddevname; grub_snprintf (bsddevname, sizeof (bsddevname), "wd%d%c", bsd_device, @@ -502,11 +503,12 @@ grub_cmd_legacy_initrdnounzip (struct grub_command *mycmd __attribute__ ((unused { char **newargs; grub_err_t err; + char nounzipbuf[10] = "--nounzip"; newargs = grub_malloc ((argc + 1) * sizeof (newargs[0])); if (!newargs) return grub_errno; grub_memcpy (newargs + 1, args, argc * sizeof (newargs[0])); - newargs[0] = "--nounzip"; + newargs[0] = nounzipbuf; cmd = grub_command_find ("module"); if (!cmd) return grub_error (GRUB_ERR_BAD_ARGUMENT, "command module not found");