Commit Diff


commit - fdfa61d55ed7f0ca9bf766eb2b9ee9d023ac0216
commit + 43428b698225cb8ddfebc487046c88ddc05fe482
blob - 5413e13bfb7c423c6a5ab0d75f5d99246d265324
blob + 3c478061183953dea96fa8d0959f15ea695dfbed
--- lib/pack.c
+++ lib/pack.c
@@ -688,6 +688,8 @@ got_packidx_get_object_id(struct got_object_id *id,
 		return got_error(GOT_ERR_NO_OBJ);
 
 	oid = packidx->hdr.sorted_ids + (idx * idlen);
+
+	memset(id, 0, sizeof(*id));
 	memcpy(id->hash, oid->hash, idlen);
 	return NULL;
 }
blob - 7e257b5af05bc5505443956f102845a47d44621e
blob + 6f19228c1f6aa043ae19b8feadf8e569d5b04fce
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
@@ -300,6 +300,7 @@ fetch_ref(struct imsgbuf *ibuf, struct got_pathlist_he
 	const struct got_error *err;
 	char *theirs = NULL, *mine = NULL;
 
+	memset(want, 0, sizeof(*want));
 	if (!got_parse_sha1_digest(want->hash, id_str)) {
 		err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
 		goto done;
blob - 906bd340c0ec0f20b425eba053d72bcfd58b944f
blob + 66ab28ef7943fa60e5850fb0ece295e556c25239
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -942,8 +942,6 @@ search_delta_for_object(struct got_object_id *id, void
 	size_t delta_size, delta_compressed_size;
 	off_t delta_offset, delta_data_offset, base_offset;
 	struct got_object_id base_id;
-
-	memset(&base_id, 0, sizeof(base_id));
 
 	if (sigint_received)
 		return got_error(GOT_ERR_CANCELLED);