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

Re: [PATCH 1/1] attr: enable attr pathspec magic for git-add and git-stash

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 2, 2023, 23:45 UTC
Message-ID
<xmqq34xnlny7.fsf@gitster.g>
In-Reply-To
<xmqqil6jlu3m.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
>> +	} else {
>> +		/* For an element in longhand form, we simply copy everything up to the final ')' */
>
> A comment that is a bit on the overly-long side.
>
>> +		int len = strchr(element, ')') - element;
>> +		strbuf_add(sb, element, len);

In practice, nobody sane would write a pathspec magic that is over 2GB in size, so this would not matter unless we are facing a potential attacker, but as the third parameter strbuf_add() takes is of type size_t, it would not hurt to define "len" as the same type as well.

> Thanks for working on fixing this rather old bug.  I think we should
> have noticed when we added the support for the "attr" magic to the
> pathspec API.
Previous: Junio C HamanoNext: Joanna Wang
Message 12 of 19 in “Allow attr magic for git-add, git-stash.”
  1. 1/1 Allow attr magic for git-add, git-stash.Joanna Wang, Oct 5, 2023
  2. Junio C HamanoOct 6, 2023
  3. Junio C HamanoOct 6, 2023
  4. 1/1 add: Enable attr pathspec magic for git-add.Joanna Wang, Oct 7, 2023
  5. Joanna WangOct 7, 2023
  6. Junio C HamanoOct 7, 2023
  7. 1/1 add: enable attr pathspec magicJoanna Wang, Oct 11, 2023
  8. 1/1 attr: enable attr pathspec magic for git-add and git-stashJoanna Wang, Nov 2, 2023
  9. Junio C HamanoNov 2, 2023
  10. 1/1 attr: enable attr pathspec magic for git-add and git-stashJoanna Wang, Nov 2, 2023
  11. Junio C HamanoNov 2, 2023
  12. Junio C HamanoNov 2, 2023
  13. 1/1 attr: enable attr pathspec magic for git-add and git-stashJoanna Wang, Nov 3, 2023
  14. Ruben SafirNov 3, 2023
  15. 1/1 attr: enable attr pathspec magic for git-add and git-stashJoanna Wang, Nov 3, 2023
  16. Junio C HamanoNov 4, 2023
  17. Eric SunshineNov 4, 2023
  18. Junio C HamanoNov 4, 2023
  19. Junio C HamanoNov 9, 2023

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.