From: Michael Haggerty Date: Thu, 15 Sep 2011 21:10:36 +0000 (+0200) Subject: resolve_ref(): do not follow incorrectly-formatted symbolic refs X-Git-Tag: v1.7.8-rc0~19^2~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=313fb010da4343eca22ee48a2cc18048d999de53;p=git.git resolve_ref(): do not follow incorrectly-formatted symbolic refs Emit a warning and fail if a symbolic reference refers to an incorrectly-formatted refname. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- diff --git a/refs.c b/refs.c index 473f7f6bc..b05550189 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;