commit 2399b53d3a5f7a784efc54b86027b4f50f65ac41 from: Omar Polo date: Tue Jun 14 08:26:27 2022 UTC style; set datalen only once commit - 71393b5c7fb0a8cff0c8fd7890c3954e3f3a9599 commit + 2399b53d3a5f7a784efc54b86027b4f50f65ac41 blob - ba8b3d3062d617cc43cb3864675177c5e6a566b6 blob + e14bc4b63112230a31cd5231efc94a703c80f4e9 --- lib/patch.c +++ lib/patch.c @@ -224,6 +224,7 @@ recv_patch(struct imsgbuf *ibuf, int *done, struct got return err; } + datalen = imsg.hdr.len - IMSG_HEADER_SIZE; switch (imsg.hdr.type) { case GOT_IMSG_PATCH_DONE: if (h != NULL && h->len == 0) @@ -236,7 +237,6 @@ recv_patch(struct imsgbuf *ibuf, int *done, struct got goto done; } lastmode = -1; - datalen = imsg.hdr.len - IMSG_HEADER_SIZE; if (datalen != sizeof(hdr)) { err = got_error(GOT_ERR_PRIVSEP_LEN); goto done; @@ -261,7 +261,6 @@ recv_patch(struct imsgbuf *ibuf, int *done, struct got err = got_error(GOT_ERR_PRIVSEP_MSG); goto done; } - datalen = imsg.hdr.len - IMSG_HEADER_SIZE; t = imsg.data; /* at least one char */ if (datalen < 2 || t[datalen-1] != '\0') {