From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jens Lehmann <jens.lehmann@web.de>,
git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>
Subject: [PATCH] resolve_gitlink_ref_recursive(): verify format of symbolic refs
Date: Fri, 27 Jun 2014 13:01:17 +0200 [thread overview]
Message-ID: <1403866877-15733-1-git-send-email-mhagger@alum.mit.edu> (raw)
When reading a symbolic ref via resolve_gitlink_ref_recursive(), check
that the reference name that is pointed at is formatted correctly,
using the same check as resolve_ref_unsafe() uses for non-gitlink
references. This prevents bogosity like
ref: ../../other/file
from causing problems.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
Given that symbolic references cannot be transferred via the Git
protocol, I do not expect this bug to be exploitable.
refs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/refs.c b/refs.c
index dc45774..7da8e7d 100644
--- a/refs.c
+++ b/refs.c
@@ -1273,6 +1273,9 @@ static int resolve_gitlink_ref_recursive(struct ref_cache *refs,
while (isspace(*p))
p++;
+ if (check_refname_format(p, REFNAME_ALLOW_ONELEVEL))
+ return -1;
+
return resolve_gitlink_ref_recursive(refs, p, sha1, recursion+1);
}
--
2.0.0
next reply other threads:[~2014-06-27 11:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-27 11:01 Michael Haggerty [this message]
2014-06-27 17:53 ` [PATCH] resolve_gitlink_ref_recursive(): verify format of symbolic refs Junio C Hamano
2014-06-27 17:59 ` Junio C Hamano
2014-06-28 5:34 ` Michael Haggerty
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=1403866877-15733-1-git-send-email-mhagger@alum.mit.edu \
--to=mhagger@alum.mit.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jens.lehmann@web.de \
/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).