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

Re: [PATCH 2/4] receive-pack: implement advertising and receiving push options

From
Jeff King <peff@peff.net>
Date
Jul 14, 2016, 19:45 UTC
Message-ID
<20160714194522.GA17798@sigill.intra.peff.net>
In-Reply-To
<xmqqfurcqbrw.fsf@gitster.mtv.corp.google.com>
On Thu, Jul 14, 2016 at 12:07:15PM -0700, Junio C Hamano wrote:
Show 7 quoted lines
> > Although as you remarked in another email, this would not pose a problem for
> > the shell variable, so we could also drop it to allow multi line
> > options. will do.
> 
> One thing to note is that I do not think there is a guarantee that
> packet_buf[] is NUL-terminated, and when len == LAGE_PACKET_MAX, you
> do not have room to NUL-terminate it yourself.

packet_read() does NUL-terminate for you. It gets the extra bytes because it doesn't store the 4-byte size in the output (whereas the client does not ever send anything over LARGE_PACKET_MAX, _including_ those bytes, so we always have room to store its result in our LARGE_PACKET_MAX buffer, plus the NUL, with 3 bytes to spare).

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 13 in “[PATCHv5 0/4] Push options”
  1. Stefan BellerJul 14, 2016
  2. 1/4 push options: {pre,post}-receive hook learns about push optionsStefan Beller, Jul 14, 2016
  3. 2/4 receive-pack: implement advertising and receiving push optionsStefan Beller, Jul 14, 2016
  4. Junio C HamanoJul 14, 2016
  5. Stefan BellerJul 14, 2016
  6. Junio C HamanoJul 14, 2016
  7. Jeff KingJul 14, 2016
  8. Junio C HamanoJul 14, 2016
  9. 3/4 push: accept push optionsStefan Beller, Jul 14, 2016
  10. 4/4 add a test for push optionsStefan Beller, Jul 14, 2016
  11. Jeff KingJul 14, 2016
  12. Stefan BellerJul 14, 2016
  13. Jeff KingJul 14, 2016

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.