From: Michael Haggerty Date: Thu, 15 Sep 2011 21:10:36 GMT Subject: [PATCH v3 15/22] resolve_ref(): do not follow incorrectly-formatted symbolic refs Message-ID: <1316121043-29367-16-git-send-email-mhagger@alum.mit.edu> In-Reply-To: <1316121043-29367-1-git-send-email-mhagger@alum.mit.edu> Emit a warning and fail if a symbolic reference refers to an incorrectly-formatted refname. Signed-off-by: Michael Haggerty --- refs.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/refs.c b/refs.c index 473f7f6..b055501 100644 --- a/refs.c +++ b/refs.c @@ -581,6 +581,11 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int * buf = buffer + 4; while (isspace(*buf)) buf++; + if (check_refname_format(buf, REFNAME_ALLOW_ONELEVEL)) { + warning("symbolic reference in %s is formatted incorrectly", + path); + return NULL; + } ref = strcpy(ref_buffer, buf); if (flag) *flag |= REF_ISSYMREF; -- 1.7.6.8.gd2879