Commit Diff


commit - db9b9b1c2b70d98419e70b05e7283b2284bedbec
commit + a5e587e014cba0e9dc62ab1817983c89851cbe93
blob - f7736221c3c02ffd4e1d422bbe6510131dfc9e74
blob + 708d939b13209d4284366e2f64c33fc1cf476ae5
--- lib/privsep.c
+++ lib/privsep.c
@@ -3119,21 +3119,21 @@ got_privsep_send_object_idlist(struct imsgbuf *ibuf,
 {
 	const struct got_error *err = NULL;
 	struct got_object_id *idlist[GOT_IMSG_OBJ_ID_LIST_MAX_NIDS];
-	int i, j = 0;
+	int i, queued = 0;
 
 	for (i = 0; i < nids; i++) {
-		j = i % nitems(idlist);
-		idlist[j] = ids[i];
-		if (j >= nitems(idlist) - 1) {
-			err = send_idlist(ibuf, idlist, j + 1);
+		idlist[i % nitems(idlist)] = ids[i];
+		queued++;
+		if (queued >= nitems(idlist) - 1) {
+			err = send_idlist(ibuf, idlist, queued);
 			if (err)
 				return err;
-			j = 0;
+			queued = 0;
 		}
 	}
 
-	if (j > 0) {
-		err = send_idlist(ibuf, idlist, j + 1);
+	if (queued > 0) {
+		err = send_idlist(ibuf, idlist, queued);
 		if (err)
 			return err;
 	}
blob - 4b46e10d580fcd5a865ba785169787d0463eb2b0
blob + c852d54f14a6f88d30757457e124d1ba29d63063
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -1388,6 +1388,11 @@ enumeration_request(struct imsg *imsg, struct imsgbuf 
 	if (err)
 		goto done;
 
+	if (STAILQ_EMPTY(&commit_ids)) {
+		err = got_error(GOT_ERR_PRIVSEP_MSG);
+		goto done;
+	}
+
 	err = recv_object_ids(idset, ibuf);
 	if (err)
 		goto done;