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

Re: [PATCH] setup.c: Fix prefix_pathspec from looping pass end of string

From
Andrew Wong <andrew.kw.w@gmail.com>
Date
Mar 7, 2013, 22:25 UTC
Message-ID
<CADgNjakrBCD2jMNUz95E-7FkyKmNgcQeuz8grDWczb-hM6yHhg@mail.gmail.com>
In-Reply-To
<7vobeulw4d.fsf@alter.siamese.dyndns.org>
On 3/7/13, Junio C Hamano <gitster@pobox.com> wrote:
> The parser that goes past the end of the string may be a bug worth
> fixing, but is this patch sufficient to diagnose such an input as an
> error?

Yea, the patch should fix the passing end of string too. The parser was going past end of string because the nextat is set to "copyfrom + len + 1" for the '\0' case too. Then "+ 1" causes the parser to go pass end of string. If we handle the '\0' case separately, then the parser ends properly, and shouldn't be able to go pass the end of string.

Hm, should I be paranoid and put an "else" clause to call die() as well? In case there's a scenario where none of the 3 cases is true...

Andrew
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 9 in “setup.c: Fix prefix_pathspec from looping pass end of string”
  1. setup.c: Fix prefix_pathspec from looping pass end of stringAndrew Wong, Mar 7, 2013
  2. Junio C HamanoMar 7, 2013
  3. Andrew WongMar 7, 2013
  4. Junio C HamanoMar 7, 2013
  5. Andrew WongMar 8, 2013
  6. Junio C HamanoMar 8, 2013
  7. Andrew WongMar 8, 2013
  8. 1/2 setup.c: Fix prefix_pathspec from looping pass end of stringAndrew Wong, Mar 9, 2013
  9. 2/2 setup.c: Check that the pathspec magic ends with ")"Andrew Wong, Mar 9, 2013

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.