X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=receive-pack.c;h=f83ae87e150ff93728da989f1d35ce0ad7c10f60;hb=fae09a8084c9b51632726523b477a78dd28d7d7e;hp=d0a563df6457a6fc5b40b3502582a78fafdadd53;hpb=eab827072d1e197eb6ccb6f75e7fe86143735f1e;p=git.git diff --git a/receive-pack.c b/receive-pack.c index d0a563df6..f83ae87e1 100644 --- a/receive-pack.c +++ b/receive-pack.c @@ -132,6 +132,7 @@ static int run_hook(const char *hook_name) break; } } + close(proc.in); return hook_status(finish_command(&proc), hook_name); } @@ -165,7 +166,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"; } @@ -413,6 +415,7 @@ static const char *unpack(void) if (start_command(&ip)) return "index-pack fork failed"; pack_lockfile = index_pack_lockfile(ip.out); + close(ip.out); status = finish_command(&ip); if (!status) { reprepare_packed_git(); @@ -468,6 +471,8 @@ int main(int argc, char **argv) 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);