Commit Diff


commit - 4b4da3bbc7a791ba0d7d9d369dfe1e7b65f7eed4
commit + 0701e66c20d0558f1f7c72d7fb700be6fe376d3f
blob - 5cd84b1d07b71a363119a7b5be1358853e0bbae4
blob + 6a64f1edca2e533d797c2fc7ebd6e8d738023fa4
--- lib/got_lib_privsep.h
+++ lib/got_lib_privsep.h
@@ -433,7 +433,7 @@ struct got_imsg_fetch_symrefs {
 /* Structure for GOT_IMSG_FETCH_REF data. */
 struct got_imsg_fetch_ref {
 	/* Describes a reference which will be fetched. */
-	uint8_t refid[SHA1_DIGEST_LENGTH];
+	struct got_object_id refid;
 	/* Followed by reference name in remaining data of imsg buffer. */
 };
 
blob - 8d1d159abb0e90556d55e25ea4c8cd028a9deed9
blob + 16a24da99f408f5487194b9f4ff88b84b5add165
--- lib/privsep.c
+++ lib/privsep.c
@@ -736,7 +736,7 @@ got_privsep_recv_fetch_progress(int *done, struct got_
 		}
 		break;
 	case GOT_IMSG_FETCH_REF:
-		if (datalen <= SHA1_DIGEST_LENGTH) {
+		if (datalen <= sizeof(**id)) {
 			err = got_error(GOT_ERR_PRIVSEP_MSG);
 			break;
 		}
@@ -745,9 +745,9 @@ got_privsep_recv_fetch_progress(int *done, struct got_
 			err = got_error_from_errno("malloc");
 			break;
 		}
-		memcpy((*id)->sha1, imsg.data, SHA1_DIGEST_LENGTH);
-		*refname = strndup(imsg.data + SHA1_DIGEST_LENGTH,
-		    datalen - SHA1_DIGEST_LENGTH);
+		memcpy(*id, imsg.data, sizeof(**id));
+		*refname = strndup(imsg.data + sizeof(**id),
+		    datalen - sizeof(**id));
 		if (*refname == NULL) {
 			err = got_error_from_errno("strndup");
 			break;
blob - c50d0f24ed274911250dfe62449bff9b131f93d3
blob + 77ba914fb971f5e412b57bd1633bda6ee0e1f26d
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
@@ -281,7 +281,7 @@ send_fetch_ref(struct imsgbuf *ibuf, struct got_object
 		return got_error_from_errno("imsg_create FETCH_REF");
 
 	/* Keep in sync with struct got_imsg_fetch_ref definition! */
-	if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1)
+	if (imsg_add(wbuf, refid, sizeof(*refid)) == -1)
 		return got_error_from_errno("imsg_add FETCH_REF");
 	if (imsg_add(wbuf, refname, reflen) == -1)
 		return got_error_from_errno("imsg_add FETCH_REF");