commit f4d0a1a4708d18a8828a92ae0123d1300e4cacad from: Stefan Sperling date: Wed Mar 18 16:13:42 2020 UTC remove header check from got-fetch-pack; not needed commit - 294dfefdc61388c8c4fedab181890b6eafbbf026 commit + f4d0a1a4708d18a8828a92ae0123d1300e4cacad blob - bbc450c8f90abf44d108cd6ea866d2f55f94713e blob + 913393e0538ea85ff30ac2493fa08b0469e9272b --- libexec/got-fetch-pack/got-fetch-pack.c +++ libexec/got-fetch-pack/got-fetch-pack.c @@ -476,7 +476,6 @@ fetch_pack(int fd, int packfd, struct got_object_id *p struct got_pathlist_head symrefs; struct got_pathlist_entry *pe; int have_sidebands = 0; - uint32_t nobjects = 0; TAILQ_INIT(&symrefs); @@ -699,32 +698,6 @@ fetch_pack(int fd, int packfd, struct got_object_id *p break; } - /* Check pack file header. */ - if (nobjects == 0) { - struct got_packfile_hdr *hdr = (void *)buf; - if (r < sizeof(*hdr)) { - err = got_error_msg(GOT_ERR_BAD_PACKFILE, - "short packfile header"); - goto done; - } - if (hdr->signature != htobe32(GOT_PACKFILE_SIGNATURE)) { - err = got_error_msg(GOT_ERR_BAD_PACKFILE, - "bad packfile signature"); - goto done; - } - if (hdr->version != htobe32(GOT_PACKFILE_VERSION)) { - err = got_error_msg(GOT_ERR_BAD_PACKFILE, - "bad packfile version"); - goto done; - } - nobjects = betoh32(hdr->nobjects); - if (nobjects == 0) { - err = got_error_msg(GOT_ERR_BAD_PACKFILE, - "bad packfile with zero objects"); - goto done; - } - } - /* Write packfile data to temporary pack file. */ w = write(packfd, buf, r); if (w == -1) {