* grub-core/disk/geli.c (grub_md_sha256_real): Respect format security.

(grub_md_sha512_real): Likewise.
	(grub_util_get_geli_uuid): Likewise.
	* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors): Likewise.
	(grub_util_biosdisk_open): Fix format specification.
	Respect format security.
	* grub-core/kern/emu/misc.c (xmalloc): Respect format security.
	(xrealloc): Likewise.
	(xasprintf): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-10 14:01:53 +01:00
parent 5ebd976935
commit 7e94d044ad
4 changed files with 23 additions and 10 deletions

View file

@ -1,3 +1,15 @@
2012-02-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/geli.c (grub_md_sha256_real): Respect format security.
(grub_md_sha512_real): Likewise.
(grub_util_get_geli_uuid): Likewise.
* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors): Likewise.
(grub_util_biosdisk_open): Fix format specification.
Respect format security.
* grub-core/kern/emu/misc.c (xmalloc): Respect format security.
(xrealloc): Likewise.
(xasprintf): Likewise.
2012-02-10 Vladimir Serbinenko <phcoder@gmail.com>
* util/import_gcry.py: Include grub/crypto.h in init.c.

View file

@ -72,7 +72,7 @@ grub_md_sha256_real (void)
const gcry_md_spec_t *ret;
ret = grub_crypto_lookup_md_by_name ("sha256");
if (!ret)
grub_util_error (_("Coulnd't load sha256"));
grub_util_error ("%s", _("Coulnd't load sha256"));
return ret;
}
@ -82,7 +82,7 @@ grub_md_sha512_real (void)
const gcry_md_spec_t *ret;
ret = grub_crypto_lookup_md_by_name ("sha512");
if (!ret)
grub_util_error (_("Coulnd't load sha512"));
grub_util_error ("%s", _("Coulnd't load sha512"));
return ret;
}
@ -226,7 +226,7 @@ grub_util_get_geli_uuid (const char *dev)
uuid = xmalloc (GRUB_MD_SHA256->mdlen * 2 + 1);
if (grub_util_fd_read (fd, (void *) &hdr, 512) < 0)
grub_util_error (_("couldn't read ELI metadata"));
grub_util_error ("%s", _("couldn't read ELI metadata"));
COMPILE_TIME_ASSERT (sizeof (header) <= 512);
header = (void *) &hdr;
@ -235,7 +235,7 @@ grub_util_get_geli_uuid (const char *dev)
if (grub_memcmp (header->magic, GELI_MAGIC, sizeof (GELI_MAGIC))
|| grub_le_to_cpu32 (header->version) > 5
|| grub_le_to_cpu32 (header->version) < 1)
grub_util_error (_("wrong ELI magic or version"));
grub_util_error ("%s", _("wrong ELI magic or version"));
err = make_uuid ((void *) &hdr, uuid);
if (err)

View file

@ -308,7 +308,7 @@ grub_util_get_fd_sectors (int fd, const char *name, unsigned *log_secsize)
return minfo.dki_capacity;
# else
if (nr & ((1 << log_sector_size) - 1))
grub_util_error (_("unaligned device size"));
grub_util_error ("%s", _("unaligned device size"));
return (nr >> log_sector_size);
# endif
@ -387,7 +387,8 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
close (fd);
grub_util_info ("the size of %s is %llu", name, disk->total_sectors);
grub_util_info ("the size of %s is %" PRIuGRUB_UINT64_T,
name, disk->total_sectors);
return GRUB_ERR_NONE;
}
@ -771,7 +772,7 @@ grub_hostdisk_os_dev_to_grub_drive (const char *os_disk, int add)
return NULL;
if (i == ARRAY_SIZE (map))
grub_util_error (_("device count exceeds limit"));
grub_util_error ("%s", _("device count exceeds limit"));
map[i].device = xstrdup (os_disk);
map[i].drive = xmalloc (sizeof ("hostdisk/") + strlen (os_disk));

View file

@ -117,7 +117,7 @@ xmalloc (grub_size_t size)
p = malloc (size);
if (! p)
grub_util_error (_("out of memory"));
grub_util_error ("%s", _("out of memory"));
return p;
}
@ -127,7 +127,7 @@ xrealloc (void *ptr, grub_size_t size)
{
ptr = realloc (ptr, size);
if (! ptr)
grub_util_error (_("out of memory"));
grub_util_error ("%s", _("out of memory"));
return ptr;
}
@ -185,7 +185,7 @@ xasprintf (const char *fmt, ...)
if (vasprintf (&result, fmt, ap) < 0)
{
if (errno == ENOMEM)
grub_util_error (_("out of memory"));
grub_util_error ("%s", _("out of memory"));
return NULL;
}