grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grub-probe gets a segfault


From: Isaac M. Marcos
Subject: Re: grub-probe gets a segfault
Date: Fri, 23 May 2008 19:40:52 -0430
User-agent: KMail/1.9.9

El Thursday 22 May 2008 06:22:02 Pavel Roskin escribió:
> On Wed, 2008-05-21 at 20:20 -0430, Isaac M. Marcos wrote:
> > Today, I bump on this problem again on updating kernel. Because of this
> > fault, update-initramfs reports a failure. It can't find "/".
> >
> > grub-probe -t device /      -->     segfault!!
>
> This patch should help.  It checks for the buffer overrun.  I still feel
> uneasy about applying it because it hides a bigger problem.

I *completely* agree with you.

> diff --git a/disk/lvm.c b/disk/lvm.c
> index 1d898ff..997d15c 100644
> --- a/disk/lvm.c
> +++ b/disk/lvm.c
> @@ -302,9 +302,12 @@ grub_lvm_scan_device (const char *name)
>    rlocn = mdah->raw_locns;
>    p = q = metadatabuf + grub_le_to_cpu64 (rlocn->offset);
>
> -  while (*q != ' ')
> +  while (*q != ' ' && q < metadatabuf + mda_size)
>      q++;
>
> +  if (q == metadatabuf + mda_size)
> +    goto fail2;
> +
>    vgname_len = q - p;
>    vgname = grub_malloc (vgname_len + 1);
>    if (!vgname)

Sorry for the delay, other problems had higher priority :-)

Fine, to the problem at hand:

Patch applied, compiled, and  working OK:
        $ sudo grub-probe -t device /
        /dev/sda2

Would this change be committed to cvs?

-- 
Isaac M. Marcos
GPG key 0xC9045C1B
5633 ECAF 44B1 8A5D 9371 DCDA 4620 A016 C904 5C1B

The only place success comes before work is in the dictionary.
VINCE LOMBARDI

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]