* grub-core/commands/legacycfg.c (grub_cmd_legacy_kernel):

Avoid improper use of strings.
	(grub_cmd_legacy_initrdnounzip): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-10 14:30:19 +01:00
parent dfdffd0d94
commit 29a3550b61
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2012-02-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/legacycfg.c (grub_cmd_legacy_kernel):
Avoid improper use of strings.
(grub_cmd_legacy_initrdnounzip): Likewise.
2012-02-10 Vladimir Serbinenko <phcoder@gmail.com> 2012-02-10 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/emu/misc.h (grub_util_warn): Add missing format * include/grub/emu/misc.h (grub_util_warn): Add missing format

View file

@ -411,10 +411,11 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
} }
else else
{ {
char rbuf[3] = "-r";
bsdargc = cutargc + 2; bsdargc = cutargc + 2;
bsdargs = grub_malloc (sizeof (bsdargs[0]) * bsdargc); bsdargs = grub_malloc (sizeof (bsdargs[0]) * bsdargc);
grub_memcpy (bsdargs, args, argc * sizeof (bsdargs[0])); grub_memcpy (bsdargs, args, argc * sizeof (bsdargs[0]));
bsdargs[argc] = "-r"; bsdargs[argc] = rbuf;
bsdargs[argc + 1] = bsddevname; bsdargs[argc + 1] = bsddevname;
grub_snprintf (bsddevname, sizeof (bsddevname), grub_snprintf (bsddevname, sizeof (bsddevname),
"wd%d%c", bsd_device, "wd%d%c", bsd_device,
@ -502,11 +503,12 @@ grub_cmd_legacy_initrdnounzip (struct grub_command *mycmd __attribute__ ((unused
{ {
char **newargs; char **newargs;
grub_err_t err; grub_err_t err;
char nounzipbuf[10] = "--nounzip";
newargs = grub_malloc ((argc + 1) * sizeof (newargs[0])); newargs = grub_malloc ((argc + 1) * sizeof (newargs[0]));
if (!newargs) if (!newargs)
return grub_errno; return grub_errno;
grub_memcpy (newargs + 1, args, argc * sizeof (newargs[0])); grub_memcpy (newargs + 1, args, argc * sizeof (newargs[0]));
newargs[0] = "--nounzip"; newargs[0] = nounzipbuf;
cmd = grub_command_find ("module"); cmd = grub_command_find ("module");
if (!cmd) if (!cmd)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "command module not found"); return grub_error (GRUB_ERR_BAD_ARGUMENT, "command module not found");