receive-pack: reject invalid refnames
authorMartin Koegler <mkoegler@auto.tuwien.ac.at>
Fri, 4 Jan 2008 19:37:17 +0000 (20:37 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 4 Jan 2008 23:59:43 +0000 (15:59 -0800)
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
receive-pack.c
index d0a563df6457a6fc5b40b3502582a78fafdadd53..326749583221d0f5e81f58608a23ab1dc1601177 100644 (file)
@@ -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";
        }