shithub: riscv

Download patch

ref: 408242edcf4ccf64baa1d599cec448451184c419
parent: f87c5f7f43ce3ab4e160b9985b30eb548ee75646
author: Ori Bernstein <ori@eigenstate.org>
date: Fri May 20 13:16:41 EDT 2022

git: improve error on short read

we don't recover from an invalid packet, so just
sysfatal with a useful message.

--- a/sys/src/cmd/git/proto.c
+++ b/sys/src/cmd/git/proto.c
@@ -58,8 +58,8 @@
 	char *e;
 	int n;
 
-	if(readn(c->rfd, len, 4) == -1)
-		return -1;
+	if(readn(c->rfd, len, 4) != 4)
+		sysfatal("pktline: short read from transport");
 	len[4] = 0;
 	n = strtol(len, &e, 16);
 	if(n == 0){