From: Junio C Hamano Date: Mon, 20 Aug 2012 17:39:57 GMT Subject: [PATCH 2/2] get_fetch_map(): tighten checks on dest refs Message-ID: <1345484397-10958-3-git-send-email-gitster@pobox.com> In-Reply-To: <1345484397-10958-1-git-send-email-gitster@pobox.com> The code to check the refname we store the fetched result locally did not bother checking the first 5 bytes of it, presumably assuming that it always begin with "refs/". For a fetch refspec (or the result of applying wildcard on one), we always want the RHS to map to something inside "refs/" hierarchy, so let's spell that rule out in a more explicit way. Signed-off-by: Junio C Hamano --- remote.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/remote.c b/remote.c index eacd8ad..0f2b1db 100644 --- a/remote.c +++ b/remote.c @@ -1402,8 +1402,8 @@ int get_fetch_map(const struct ref *remote_refs, for (rmp = &ref_map; *rmp; ) { if ((*rmp)->peer_ref) { - if (check_refname_format((*rmp)->peer_ref->name + 5, - REFNAME_ALLOW_ONELEVEL)) { + if (prefixcmp((*rmp)->peer_ref->name, "refs/") || + check_refname_format((*rmp)->peer_ref->name, 0)) { struct ref *ignore = *rmp; error("* Ignoring funny ref '%s' locally", (*rmp)->peer_ref->name); -- 1.7.12.92.g7963261