git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
To: markus.heidelberg@web.de
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Fix buffer overflow in config parser
Date: Thu, 9 Apr 2009 09:59:28 +0200	[thread overview]
Message-ID: <200904090959.28646.thomas.jarosch@intra2net.com> (raw)
In-Reply-To: <200904090115.17609.markus.heidelberg@web.de>

On Thursday, 9. April 2009 01:15:17 Markus Heidelberg wrote:
> > > diff --git a/config.c b/config.c
> > > index b76fe4c..a9c67e8 100644
> > > --- a/config.c
> > > +++ b/config.c
> > > @@ -72,7 +72,7 @@ static char *parse_value(void)
> > >                         }
> > >                 }
> > >                 if (space) {
> > > -                       if (len)
> > > +                       if (len && len < sizeof(value)-1)
> > >                                 value[len++] = ' ';
> > >                         space = 0;
>
> Eh, or maybe better add a "continue;" here, so that only one char per
> loop is read.

Thanks for the review.

If I understand the intention of the complete code correctly, the idea was
to read in 1+ spaces and put -one- space in the buffer as soon as the first
non-space character is encountered (if not inside quotes).

Adding a "continue" statement would eat up the first non-space character.

I guess it's ok to modify the first size check or keep to problem local and 
check the size before putting the space in the buffer. Guess that's up to
the maintainer which method he prefers.

Cheers,
Thomas

  reply	other threads:[~2009-04-09  8:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 22:13 [PATCH] Fix buffer overflow in config parser Thomas Jarosch
2009-04-08 22:58 ` Markus Heidelberg
2009-04-08 23:15   ` Markus Heidelberg
2009-04-09  7:59     ` Thomas Jarosch [this message]
2009-04-10 16:10       ` Markus Heidelberg

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=200904090959.28646.thomas.jarosch@intra2net.com \
    --to=thomas.jarosch@intra2net.com \
    --cc=git@vger.kernel.org \
    --cc=markus.heidelberg@web.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).