grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] fix off-by-one in grub_file_getline


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: [PATCH] fix off-by-one in grub_file_getline
Date: Thu, 31 May 2012 14:35:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

Committed, thanks. Could you supply ChangeLog entry next time?
On 31.05.2012 13:43, Christer Weinigel wrote:

> I'd like to submit a few trivial patches that I've had on my hard
> drive for a while.  This patch is against the latest version in the
> trunk on bzr.savannah.gnu.org.
> 
> If grub_file_getline tries to read a line which is exactly
> 64 bytes long it will write the terminating zero past the
> end of the allocated buffer causing memory corruption.
> 
> Trivial fix which reserves one more byte in the buffer.
> 
> diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
> index feeb1ef..eb4b1c7 100644
> --- a/grub-core/normal/main.c
> +++ b/grub-core/normal/main.c
> @@ -65,7 +65,7 @@ grub_file_getline (grub_file_t file)
>       continue;
>  
>  
> -      if (pos >= max_len)
> +      if (pos + 1 >= max_len)
>       {
>         char *old_cmdline = cmdline;
>         max_len = max_len * 2;
> 



-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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