Avoid NULL deref in grub_device_open.

* grub-core/kern/device.c (grub_device_open): Don't dereference
	a NULL pointer upon failed grub_env_get.
This commit is contained in:
Jim Meyering 2011-06-23 18:08:53 +02:00 committed by Vladimir 'phcoder' Serbinenko
parent f7db6f4a55
commit 8a5d6919e1
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2011-06-23 Jim Meyering <meyering@redhat.com>
avoid NULL deref in grub_device_open
* grub-core/kern/device.c (grub_device_open): Don't dereference
a NULL pointer upon failed grub_env_get.
2011-06-23 Vladimir Serbinenko <phcoder@gmail.com>
Support non-512B sectors and agglomerate reads.

View file

@ -35,7 +35,7 @@ grub_device_open (const char *name)
if (! name)
{
name = grub_env_get ("root");
if (*name == '\0')
if (name == NULL || *name == '\0')
{
grub_error (GRUB_ERR_BAD_DEVICE, "no device is set");
goto fail;