All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Erik Faye-Lund <kusmabite@gmail.com>
Cc: git@vger.kernel.org, jwa@urbancode.com, drew.northup@maine.edu
Subject: Re: [PATCH v2 1/2] strbuf: make sure buffer is zero-terminated
Date: Sun, 10 Apr 2011 17:05:35 -0400	[thread overview]
Message-ID: <20110410210534.GA2522@sigill.intra.peff.net> (raw)
In-Reply-To: <BANLkTinKzatY-1kxLJ73TeDyMW175pr77A@mail.gmail.com>

On Sun, Apr 10, 2011 at 11:04:26PM +0200, Erik Faye-Lund wrote:

> > It is more than just detach, though; the
> > NUL-termination is supposed to be an invariant of strbuf, so any code
> > just looking at "sb.buf" would be broken. So your code looks fine, but
> > you may want to mention that in the commit message.
> >
> 
> You're right. How about something like this instead?
> 
> strbuf_init does not zero-terminate the initial buffer when hint is
> non-zero. Fix this so we can rely on the string to be zero-terminated
> even if we haven't filled it with anything yet.

Sure, that's fine.

-Peff

  reply	other threads:[~2011-04-10 21:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-10 20:54 [PATCH v2 1/2] strbuf: make sure buffer is zero-terminated Erik Faye-Lund
2011-04-10 20:54 ` [PATCH v2 2/2] config: support values longer than 1023 bytes Erik Faye-Lund
2011-04-10 20:58   ` Jeff King
2011-04-10 20:57 ` [PATCH v2 1/2] strbuf: make sure buffer is zero-terminated Jeff King
2011-04-10 21:04   ` Erik Faye-Lund
2011-04-10 21:05     ` Jeff King [this message]
2011-04-11 21:49     ` Junio C Hamano

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=20110410210534.GA2522@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=drew.northup@maine.edu \
    --cc=git@vger.kernel.org \
    --cc=jwa@urbancode.com \
    --cc=kusmabite@gmail.com \
    /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.