threads / patch / 11476

patchreceive-pack: reject invalid refnames

Subject: [PATCH] receive-pack: reject invalid refnames

## tl;dr

One message between Jan 4, 2008 and Jan 4, 2008. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Martin Koegler· Jan 4, 2008, 19:37 UTC · lore
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
 receive-pack.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Show changes to receive-pack.c +2 −1
diff --git a/receive-pack.c b/receive-pack.c
index d0a563d..3267495 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -165,7 +165,8 @@ static const char *update(struct command *cmd)
 	unsigned char *new_sha1 = cmd->new_sha1;
 	struct ref_lock *lock;
 
-	if (!prefixcmp(name, "refs/") && check_ref_format(name + 5)) {
+	/* only refs/... are allowed */
+	if (prefixcmp(name, "refs/") || check_ref_format(name + 5)) {
 		error("refusing to create funny ref '%s' remotely", name);
 		return "funny refname";
 	}
-- 
1.4.4.4

← back to recent threads