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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
c224ca7f66
commit
313fb010da
5
refs.c
5
refs.c
@ -581,6 +581,11 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
|
|||||||
buf = buffer + 4;
|
buf = buffer + 4;
|
||||||
while (isspace(*buf))
|
while (isspace(*buf))
|
||||||
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);
|
ref = strcpy(ref_buffer, buf);
|
||||||
if (flag)
|
if (flag)
|
||||||
*flag |= REF_ISSYMREF;
|
*flag |= REF_ISSYMREF;
|
||||||
|
Reference in New Issue
Block a user