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

Re: [PATCH 1/2] read_info_alternates: read contents into strbuf

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 19, 2017, 00:08 UTC
Message-ID
<xmqqvakfsg75.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170918155429.hgql4ngayun5nbyd@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> We could also just make a NUL-terminated copy of the input
> bytes and operate on that. But since all but one caller
> already is passing a string, instead let's just fix that
> caller to provide NUL-terminated input in the first place,
> by swapping out mmap for strbuf_read_file().
> ...
> Let's also drop the "len" parameter entirely from
> link_alt_odb_entries(), since it's completely ignored. That
> will avoid any new callers re-introducing a similar bug.
Both design decisions make perfect sense to me.
>  sha1_file.c | 29 +++++++++--------------------
>  1 file changed, 9 insertions(+), 20 deletions(-)
And diffstat also agrees that it is a good change ;-)
Previous: Jeff KingNext: Jonathan Nieder
Message 3 of 14 in “fix read past end of array in alternates files”
  1. 0/2 fix read past end of array in alternates filesJeff King, Sep 18, 2017
  2. 1/2 read_info_alternates: read contents into strbufJeff King, Sep 18, 2017
  3. Junio C HamanoSep 19, 2017
  4. Jonathan NiederSep 19, 2017
  5. Jeff KingSep 19, 2017
  6. 2/2 read_info_alternates: warn on non-trivial errorsJeff King, Sep 18, 2017
  7. Jonathan NiederSep 19, 2017
  8. Jeff KingSep 19, 2017
  9. Jonathan NiederSep 19, 2017
  10. Jeff KingSep 19, 2017
  11. 0/2 fix read past end of array in alternates filesJeff King, Sep 19, 2017
  12. 1/2 read_info_alternates: read contents into strbufJeff King, Sep 19, 2017
  13. 2/2 read_info_alternates: warn on non-trivial errorsJeff King, Sep 19, 2017
  14. Junio C HamanoSep 20, 2017

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.