Always initialise *relroot in grub_find_root_device_from_mountinfo,
otherwise we free an uninitialised pointer if /proc is unmounted. Reported by: Scott Moser.
This commit is contained in:
parent
944404efb8
commit
11b970d7c9
1 changed files with 3 additions and 3 deletions
|
@ -111,13 +111,13 @@ grub_find_root_device_from_mountinfo (const char *dir, char **relroot)
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
|
|
||||||
|
if (relroot)
|
||||||
|
*relroot = NULL;
|
||||||
|
|
||||||
fp = fopen ("/proc/self/mountinfo", "r");
|
fp = fopen ("/proc/self/mountinfo", "r");
|
||||||
if (! fp)
|
if (! fp)
|
||||||
return NULL; /* fall through to other methods */
|
return NULL; /* fall through to other methods */
|
||||||
|
|
||||||
if (relroot)
|
|
||||||
*relroot = NULL;
|
|
||||||
|
|
||||||
while (getline (&buf, &len, fp) > 0)
|
while (getline (&buf, &len, fp) > 0)
|
||||||
{
|
{
|
||||||
int mnt_id, parent_mnt_id;
|
int mnt_id, parent_mnt_id;
|
||||||
|
|
Loading…
Reference in a new issue