All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] fix off-by-one in grub_file_getline
Date: Thu, 31 May 2012 14:35:14 +0200	[thread overview]
Message-ID: <4FC76582.8040501@gmail.com> (raw)
In-Reply-To: <20120531114329.5438760D07@zoo.weinigel.se>

[-- Attachment #1: Type: text/plain, Size: 990 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

      reply	other threads:[~2012-05-31 12:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-31 11:43 [PATCH] fix off-by-one in grub_file_getline Christer Weinigel
2012-05-31 12:35 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FC76582.8040501@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.