* 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:
parent
5ebd976935
commit
7e94d044ad
4 changed files with 23 additions and 10 deletions
12
ChangeLog
12
ChangeLog
|
@ -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>
|
2012-02-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* util/import_gcry.py: Include grub/crypto.h in init.c.
|
* util/import_gcry.py: Include grub/crypto.h in init.c.
|
||||||
|
|
|
@ -72,7 +72,7 @@ grub_md_sha256_real (void)
|
||||||
const gcry_md_spec_t *ret;
|
const gcry_md_spec_t *ret;
|
||||||
ret = grub_crypto_lookup_md_by_name ("sha256");
|
ret = grub_crypto_lookup_md_by_name ("sha256");
|
||||||
if (!ret)
|
if (!ret)
|
||||||
grub_util_error (_("Coulnd't load sha256"));
|
grub_util_error ("%s", _("Coulnd't load sha256"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ grub_md_sha512_real (void)
|
||||||
const gcry_md_spec_t *ret;
|
const gcry_md_spec_t *ret;
|
||||||
ret = grub_crypto_lookup_md_by_name ("sha512");
|
ret = grub_crypto_lookup_md_by_name ("sha512");
|
||||||
if (!ret)
|
if (!ret)
|
||||||
grub_util_error (_("Coulnd't load sha512"));
|
grub_util_error ("%s", _("Coulnd't load sha512"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ grub_util_get_geli_uuid (const char *dev)
|
||||||
|
|
||||||
uuid = xmalloc (GRUB_MD_SHA256->mdlen * 2 + 1);
|
uuid = xmalloc (GRUB_MD_SHA256->mdlen * 2 + 1);
|
||||||
if (grub_util_fd_read (fd, (void *) &hdr, 512) < 0)
|
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);
|
COMPILE_TIME_ASSERT (sizeof (header) <= 512);
|
||||||
header = (void *) &hdr;
|
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))
|
if (grub_memcmp (header->magic, GELI_MAGIC, sizeof (GELI_MAGIC))
|
||||||
|| grub_le_to_cpu32 (header->version) > 5
|
|| grub_le_to_cpu32 (header->version) > 5
|
||||||
|| grub_le_to_cpu32 (header->version) < 1)
|
|| 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);
|
err = make_uuid ((void *) &hdr, uuid);
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -308,7 +308,7 @@ grub_util_get_fd_sectors (int fd, const char *name, unsigned *log_secsize)
|
||||||
return minfo.dki_capacity;
|
return minfo.dki_capacity;
|
||||||
# else
|
# else
|
||||||
if (nr & ((1 << log_sector_size) - 1))
|
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);
|
return (nr >> log_sector_size);
|
||||||
# endif
|
# endif
|
||||||
|
@ -387,7 +387,8 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
|
||||||
|
|
||||||
close (fd);
|
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;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -771,7 +772,7 @@ grub_hostdisk_os_dev_to_grub_drive (const char *os_disk, int add)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (i == ARRAY_SIZE (map))
|
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].device = xstrdup (os_disk);
|
||||||
map[i].drive = xmalloc (sizeof ("hostdisk/") + strlen (os_disk));
|
map[i].drive = xmalloc (sizeof ("hostdisk/") + strlen (os_disk));
|
||||||
|
|
|
@ -117,7 +117,7 @@ xmalloc (grub_size_t size)
|
||||||
|
|
||||||
p = malloc (size);
|
p = malloc (size);
|
||||||
if (! p)
|
if (! p)
|
||||||
grub_util_error (_("out of memory"));
|
grub_util_error ("%s", _("out of memory"));
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ xrealloc (void *ptr, grub_size_t size)
|
||||||
{
|
{
|
||||||
ptr = realloc (ptr, size);
|
ptr = realloc (ptr, size);
|
||||||
if (! ptr)
|
if (! ptr)
|
||||||
grub_util_error (_("out of memory"));
|
grub_util_error ("%s", _("out of memory"));
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ xasprintf (const char *fmt, ...)
|
||||||
if (vasprintf (&result, fmt, ap) < 0)
|
if (vasprintf (&result, fmt, ap) < 0)
|
||||||
{
|
{
|
||||||
if (errno == ENOMEM)
|
if (errno == ENOMEM)
|
||||||
grub_util_error (_("out of memory"));
|
grub_util_error ("%s", _("out of memory"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue