git-fetch-pack: Do not use git-rev-list
[git.git] / receive-pack.c
index 1ef0c13..8f157bc 100644 (file)
@@ -24,7 +24,7 @@ struct command {
        unsigned char updated;
        unsigned char old_sha1[20];
        unsigned char new_sha1[20];
-       char ref_name[];
+       char ref_name[0];
 };
 
 static struct command *commands = NULL;
@@ -95,6 +95,10 @@ static int update(const char *name,
        char new_hex[60], *old_hex, *lock_name;
        int newfd, namelen, written;
 
+       if (!strncmp(name, "refs/", 5) && check_ref_format(name + 5))
+               return error("refusing to create funny ref '%s' locally",
+                            name);
+
        namelen = strlen(name);
        lock_name = xmalloc(namelen + 10);
        memcpy(lock_name, name, namelen);