From: Junio C Hamano Date: Mon, 22 Dec 2014 20:28:04 +0000 (-0800) Subject: Merge branch 'jk/read-packed-refs-without-path-max' X-Git-Tag: v2.3.0-rc0~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa9066fccd4a4320ab3e90f566527b7497d2c7c0;p=thirdparty%2Fgit.git Merge branch 'jk/read-packed-refs-without-path-max' Git did not correctly read an overlong refname from a packed refs file. * jk/read-packed-refs-without-path-max: read_packed_refs: use skip_prefix instead of static array read_packed_refs: pass strbuf to parse_ref_line read_packed_refs: use a strbuf for reading lines --- aa9066fccd4a4320ab3e90f566527b7497d2c7c0 diff --cc refs.c index bfe4ba4213,ba3003ffd2..5fcacc6c41 --- a/refs.c +++ b/refs.c @@@ -1144,15 -1051,9 +1146,15 @@@ static void read_packed_refs(FILE *f, s continue; } - refname = parse_ref_line(refline, sha1); + refname = parse_ref_line(&line, sha1); if (refname) { - last = create_ref_entry(refname, sha1, REF_ISPACKED, 1); + int flag = REF_ISPACKED; + + if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) { + hashclr(sha1); + flag |= REF_BAD_NAME | REF_ISBROKEN; + } + last = create_ref_entry(refname, sha1, flag, 0); if (peeled == PEELED_FULLY || (peeled == PEELED_TAGS && starts_with(refname, "refs/tags/"))) last->flag |= REF_KNOWS_PEELED;