commit e05fd55cbfee4e4023db6595ae04fa79275c8637 from: Omar Polo date: Mon Feb 26 17:03:34 2024 UTC adjust min_datalen in a few places Fix the computation of min_datalen that was forgotten in 8f137979fc5e284a136cf8950e8b3895d7ea208b. got_privsep_recv_imsg() already takes care of converting GOT_IMSG_ERROR to errors, so just how we didn't need to call recv_imsg_error() at all, we don't need to include it in the requested min_datalen. commit - cc57c2cb8c8d6bc0a47692b47a6fefc5adaf2510 commit + e05fd55cbfee4e4023db6595ae04fa79275c8637 blob - 9cd5e389d8bbe7d91148d4b701ce7e577736258e blob + 857c09bbb3a5d9425176ed93727a912b2242aac6 --- lib/privsep.c +++ lib/privsep.c @@ -1187,8 +1187,7 @@ got_privsep_recv_obj(struct got_object **obj, struct i { const struct got_error *err = NULL; struct imsg imsg; - const size_t min_datalen = - MIN(sizeof(struct got_imsg_error), sizeof(struct got_imsg_object)); + const size_t min_datalen = sizeof(struct got_imsg_object); *obj = NULL; @@ -1409,9 +1408,7 @@ got_privsep_recv_commit(struct got_commit_object **com const struct got_error *err = NULL; struct imsg imsg; size_t datalen; - const size_t min_datalen = - MIN(sizeof(struct got_imsg_error), - sizeof(struct got_imsg_commit_object)); + const size_t min_datalen = sizeof(struct got_imsg_commit_object); *commit = NULL; @@ -1596,9 +1593,7 @@ const struct got_error * got_privsep_recv_tree(struct got_tree_object **tree, struct imsgbuf *ibuf) { const struct got_error *err = NULL; - const size_t min_datalen = - MIN(sizeof(struct got_imsg_error), - sizeof(struct got_imsg_tree_object)); + const size_t min_datalen = sizeof(struct got_imsg_tree_object); struct got_imsg_tree_object *itree; int nentries = 0; @@ -1853,9 +1848,7 @@ got_privsep_recv_tag(struct got_tag_object **tag, stru struct imsg imsg; struct got_imsg_tag_object *itag; size_t len, datalen; - const size_t min_datalen = - MIN(sizeof(struct got_imsg_error), - sizeof(struct got_imsg_tag_object)); + const size_t min_datalen = sizeof(struct got_imsg_tag_object); *tag = NULL; @@ -2210,8 +2203,7 @@ got_privsep_recv_gitconfig_int(int *val, struct imsgbu const struct got_error *err = NULL; struct imsg imsg; size_t datalen; - const size_t min_datalen = - MIN(sizeof(struct got_imsg_error), sizeof(int)); + const size_t min_datalen = sizeof(int); *val = 0; @@ -2488,8 +2480,7 @@ got_privsep_recv_gotconfig_remotes(struct got_remote_r size_t datalen; struct got_imsg_remotes iremotes; struct got_imsg_remote iremote; - const size_t min_datalen = - MIN(sizeof(struct got_imsg_error), sizeof(iremotes)); + const size_t min_datalen = sizeof(iremotes); *remotes = NULL; *nremotes = 0; @@ -2529,8 +2520,7 @@ got_privsep_recv_gotconfig_remotes(struct got_remote_r while (*nremotes < iremotes.nremotes) { struct got_remote_repo *remote; - const size_t min_datalen = - MIN(sizeof(struct got_imsg_error), sizeof(iremote)); + const size_t min_datalen = sizeof(iremote); int i; err = got_privsep_recv_imsg(&imsg, ibuf, min_datalen);