mirror of
https://git.proxmox.com/git/grub2
synced 2025-05-29 19:27:01 +00:00
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
@ -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 New Issue
Block a user