Merge branch 'rs/fetch-pack-invalid-lockfile'

"fetch-pack" could pass NULL pointer to unlink(2) when it sees an
invalid filename; the error checking has been tightened to make
this impossible.

* rs/fetch-pack-invalid-lockfile:
  fetch-pack: disregard invalid pack lockfiles
This commit is contained in:
Junio C Hamano
2020-12-08 15:11:20 -08:00

View File

@ -918,8 +918,9 @@ static int get_pack(struct fetch_pack_args *args,
if (start_command(&cmd)) if (start_command(&cmd))
die(_("fetch-pack: unable to fork off %s"), cmd_name); die(_("fetch-pack: unable to fork off %s"), cmd_name);
if (do_keep && pack_lockfiles) { if (do_keep && pack_lockfiles) {
string_list_append_nodup(pack_lockfiles, char *pack_lockfile = index_pack_lockfile(cmd.out);
index_pack_lockfile(cmd.out)); if (pack_lockfile)
string_list_append_nodup(pack_lockfiles, pack_lockfile);
close(cmd.out); close(cmd.out);
} }