branch_butter.patch: Don't free an uninitialised pointer if /proc is

unmounted (LP: #697493).
This commit is contained in:
Colin Watson 2011-01-07 17:28:30 +00:00
parent 715cb1e028
commit 18ca658565
2 changed files with 13 additions and 7 deletions

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
grub2 (1.99~20110106-2) UNRELEASED; urgency=low
* branch_butter.patch: Don't free an uninitialised pointer if /proc is
unmounted (LP: #697493).
-- Colin Watson <cjwatson@debian.org> Fri, 07 Jan 2011 17:27:01 +0000
grub2 (1.99~20110106-1) experimental; urgency=low grub2 (1.99~20110106-1) experimental; urgency=low
* New Bazaar snapshot. * New Bazaar snapshot.

View File

@ -1861,7 +1861,7 @@ Index: b/grub-core/kern/emu/getroot.c
=================================================================== ===================================================================
--- a/grub-core/kern/emu/getroot.c --- a/grub-core/kern/emu/getroot.c
+++ b/grub-core/kern/emu/getroot.c +++ b/grub-core/kern/emu/getroot.c
@@ -103,8 +103,8 @@ @@ -103,14 +103,17 @@
can't deal with the multiple-device case yet, but in the meantime, we can can't deal with the multiple-device case yet, but in the meantime, we can
at least cope with the single-device case by scanning at least cope with the single-device case by scanning
/proc/self/mountinfo. */ /proc/self/mountinfo. */
@ -1872,16 +1872,15 @@ Index: b/grub-core/kern/emu/getroot.c
{ {
FILE *fp; FILE *fp;
char *buf = NULL; char *buf = NULL;
@@ -115,6 +115,9 @@ size_t len = 0;
if (! fp) char *ret = NULL;
return NULL; /* fall through to other methods */
+ if (relroot) + if (relroot)
+ *relroot = NULL; + *relroot = NULL;
+ +
while (getline (&buf, &len, fp) > 0) fp = fopen ("/proc/self/mountinfo", "r");
{ if (! fp)
int mnt_id, parent_mnt_id; return NULL; /* fall through to other methods */
@@ -131,9 +134,6 @@ @@ -131,9 +134,6 @@
&count) < 6) &count) < 6)
continue; continue;