Commit Diff


commit - 9880a1ddc7243c136989370185f03cf6bdc29051
commit + eb35d814a71cef3007900867c20d881fcd173039
blob - 84db9fc5c2fd74c46922594d621a895ec6c3bfcd
blob + 46dfd0130236b332bf98cd8c4af93d819c28c9ee
--- lib/patch.c
+++ lib/patch.c
@@ -241,6 +241,10 @@ recv_patch(struct imsgbuf *ibuf, int *done, struct got
 			memcpy(&hdr, imsg.data, sizeof(hdr));
 			if ((h = calloc(1, sizeof(*h))) == NULL) {
 				err = got_error_from_errno("calloc");
+				goto done;
+			}
+			if (h->old_from < 0 || h->new_from < 0) {
+				err = got_error(GOT_ERR_PRIVSEP_LEN);
 				goto done;
 			}
 			h->old_from = hdr.oldfrom;