Re: [PATCH 05/29] refname_is_safe(): insist that the refname already be normalized
- From
David Turner <dturner@twopensource.com>
- Date
- Apr 27, 2016, 20:10 UTC
- Message-ID
- <1461787832.11504.1.camel@twopensource.com>
- In-Reply-To
- <xmqqinz39bl2.fsf@gitster.mtv.corp.google.com>
On Wed, 2016-04-27 at 10:59 -0700, Junio C Hamano wrote:
Show 11 quoted lines
> There is another call to refname_is_safe() in resolve_ref_unsafe(), > which applies the sanity check to the string from a symref. We seem > to allow > > $ git symbolic-ref refs/heads/SSS refs/heads//master > > and we end up storing "ref: refs/heads//master" (or make a symbolic > link with doubled slashes), but the current code considers the > resulting symbolic link as "dangling". Again, this change moves the > rejection a bit earlier in the codepath, without changing the end > result, I'd think.
I think we should disallow that -- refname_is_safe should probably call (or be replaced with calls to) check_refname_format.