diff --git a/receive-pack.c b/receive-pack.c
index d0a563df6457a6fc5b40b3502582a78fafdadd53..c90ec7dde28ec135f0c90e6c731b730ad4a1f7a8 100644 (file)
--- a/receive-pack.c
+++ b/receive-pack.c
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";
}
if (!dir)
usage(receive_pack_usage);
+ setup_path(NULL);
+
if (!enter_repo(dir, 0))
die("'%s': unable to chdir or not a git archive", dir);