Commit Diff


commit - 91758173656aacb101565ee19634da15141d6c11
commit + 6257c2378b7f0f559d5796ea45346551ddbe255b
blob - 66ab28ef7943fa60e5850fb0ece295e556c25239
blob + c1933a218e89a3e673b544e64831c664b87686ff
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -519,7 +519,9 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_
 			struct got_object_id id1, id2;
 			int idx;
 
-			memcpy(id1.hash, pte1->id, SHA1_DIGEST_LENGTH);
+			memset(&id1, 0, sizeof(id1));
+			id1.algo = packidx->algo;
+			memcpy(id1.hash, pte1->id, pte1->idlen);
 			idx = got_packidx_get_object_idx(packidx, &id1);
 			if (idx == -1) {
 				err = got_error_no_obj(&id1);
@@ -535,7 +537,9 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_
 			if (err)
 				break;
 
-			memcpy(id2.hash, pte2->id, SHA1_DIGEST_LENGTH);
+			memset(&id2, 0, sizeof(id2));
+			id2.algo = packidx->algo;
+			memcpy(id2.hash, pte2->id, pte2->idlen);
 			idx = got_packidx_get_object_idx(packidx, &id2);
 			if (idx == -1) {
 				err = got_error_no_obj(&id2);