git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Joanna Wang <jojwang@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/1] attr: enable attr pathspec magic for git-add and git-stash
Date: Fri, 03 Nov 2023 08:45:04 +0900	[thread overview]
Message-ID: <xmqq34xnlny7.fsf@gitster.g> (raw)
In-Reply-To: <xmqqil6jlu3m.fsf@gitster.g> (Junio C. Hamano's message of "Fri, 03 Nov 2023 06:32:13 +0900")

Junio C Hamano <gitster@pobox.com> writes:

>> +	} 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.


  reply	other threads:[~2023-11-02 23:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 23:23 [PATCH 1/1] Allow attr magic for git-add, git-stash Joanna Wang
2023-10-06  2:42 ` Junio C Hamano
2023-10-06 17:05   ` Junio C Hamano
2023-10-07  0:28     ` [PATCH 1/1] add: Enable attr pathspec magic for git-add Joanna Wang
2023-10-07  0:50       ` Joanna Wang
2023-10-07 10:10       ` [PATCH " Junio C Hamano
2023-10-11 20:20         ` [PATCH 1/1] add: enable attr pathspec magic Joanna Wang
2023-11-02  1:55           ` [PATCH 1/1] attr: enable attr pathspec magic for git-add and git-stash Joanna Wang
2023-11-02  5:00             ` Junio C Hamano
2023-11-02 17:53               ` Joanna Wang
2023-11-02 21:32                 ` Junio C Hamano
2023-11-02 23:45                   ` Junio C Hamano [this message]
2023-11-03 14:35                     ` Joanna Wang
2023-11-03 15:31                       ` Ruben Safir
2023-11-03 16:34                       ` Joanna Wang
2023-11-04  5:11                         ` Junio C Hamano
2023-11-04  6:28                           ` Eric Sunshine
2023-11-04  7:14                             ` Junio C Hamano
2023-11-09 23:27                           ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2023-11-10  2:09 Joanna Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq34xnlny7.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jojwang@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).