commit 427f294cd8765e673b3d562140ee3c5b895249fc from: Omar Polo date: Wed Feb 01 13:46:08 2023 UTC got_imsg_send_remote_ref: use struct instead of buffer for id ok stsp@ commit - 5eb14fb9cee55bc3df623de8761d1e719ae697d4 commit + 427f294cd8765e673b3d562140ee3c5b895249fc blob - 1face8ad5d73a913a43cc2f7586b6c1922ea5ec4 blob + 151e0d73fa443289c8609863654c6bef6d128723 --- lib/got_lib_privsep.h +++ lib/got_lib_privsep.h @@ -466,7 +466,7 @@ struct got_imsg_send_ref { /* Structure for GOT_IMSG_SEND_REMOTE_REF data. */ struct got_imsg_send_remote_ref { - uint8_t id[SHA1_DIGEST_LENGTH]; + struct got_object_id id; size_t name_len; /* Followed by name_len data bytes. */ } __attribute__((__packed__)); blob - 486273f87d27a716cd1cadfc39e0d0f612116981 blob + 970978560467422ed3a634b6c3b86e48e6b49fd0 --- lib/privsep.c +++ lib/privsep.c @@ -918,7 +918,7 @@ got_privsep_recv_send_remote_refs(struct got_pathlist_ err = got_error_from_errno("malloc"); goto done; } - memcpy(id->sha1, iremote_ref.id, SHA1_DIGEST_LENGTH); + memcpy(id, &iremote_ref.id, sizeof(*id)); refname = strndup(imsg.data + sizeof(iremote_ref), datalen - sizeof(iremote_ref)); if (refname == NULL) { blob - fc0bd390dcef939a8f1e78602a5314b33713e0fd blob + 0fd0e6b2e84bfc5519482bd5ae802897596069f2 --- libexec/got-send-pack/got-send-pack.c +++ libexec/got-send-pack/got-send-pack.c @@ -206,7 +206,7 @@ send_their_ref(struct imsgbuf *ibuf, struct got_object return got_error_from_errno("imsg_create SEND_REMOTE_REF"); /* Keep in sync with struct got_imsg_send_remote_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 SEND_REMOTE_REF"); if (imsg_add(wbuf, &reflen, sizeof(reflen)) == -1) return got_error_from_errno("imsg_add SEND_REMOTE_REF");