Commit f4d0a1a4708d18a8828a92ae0123d1300e4cacad

Stefan Sperling 2020-03-18T16:13:42

remove header check from got-fetch-pack; not needed

diff --git a/libexec/got-fetch-pack/got-fetch-pack.c b/libexec/got-fetch-pack/got-fetch-pack.c
index bbc450c..913393e 100644
--- a/libexec/got-fetch-pack/got-fetch-pack.c
+++ b/libexec/got-fetch-pack/got-fetch-pack.c
@@ -476,7 +476,6 @@ fetch_pack(int fd, int packfd, struct got_object_id *packid,
 	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 *packid,
 				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) {