git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/2] strbuf: make sure buffer is zero-terminated

From
Jeff King <peff@peff.net>
Date
Apr 10, 2011, 21:05 UTC
Message-ID
<20110410210534.GA2522@sigill.intra.peff.net>
In-Reply-To
<BANLkTinKzatY-1kxLJ73TeDyMW175pr77A@mail.gmail.com>
On Sun, Apr 10, 2011 at 11:04:26PM +0200, Erik Faye-Lund wrote:
Show 11 quoted lines
> > 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
Previous: Erik Faye-LundNext: Junio C Hamano
Message 6 of 7 in “strbuf: make sure buffer is zero-terminated”
  1. 1/2 strbuf: make sure buffer is zero-terminatedErik Faye-Lund, Apr 10, 2011
  2. 2/2 config: support values longer than 1023 bytesErik Faye-Lund, Apr 10, 2011
  3. Jeff KingApr 10, 2011
  4. Jeff KingApr 10, 2011
  5. Erik Faye-LundApr 10, 2011
  6. Jeff KingApr 10, 2011
  7. Junio C HamanoApr 11, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.