Skip to content

Commit 061d6b9

Browse files
Martin Koeglergitster
authored andcommitted
receive-pack: reject invalid refnames
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 872c930 commit 061d6b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

receive-pack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ static const char *update(struct command *cmd)
165165
unsigned char *new_sha1 = cmd->new_sha1;
166166
struct ref_lock *lock;
167167

168-
if (!prefixcmp(name, "refs/") && check_ref_format(name + 5)) {
168+
/* only refs/... are allowed */
169+
if (prefixcmp(name, "refs/") || check_ref_format(name + 5)) {
169170
error("refusing to create funny ref '%s' remotely", name);
170171
return "funny refname";
171172
}

0 commit comments

Comments
 (0)