shithub: riscv

Download patch

ref: 0861d0d0f283a9917721214fa3dc1c51a778213d
parent: 4e5d75d7a6ebbd2ea8111128fe772630e5d46abd
author: Ori Bernstein <ori@eigenstate.org>
date: Fri May 9 14:48:26 EDT 2025

git: fix parsing of author lines

we had two problems: the lines could get a bit tight when someone could have
very long names, and the author name was being copied into the buffer incorrectly.

--- a/sys/src/cmd/git/pack.c
+++ b/sys/src/cmd/git/pack.c
@@ -835,7 +835,8 @@
 	if(n >= sizeof(buf))
 		sysfatal("overlong author line");
 	memset(m, 0, sizeof(m));
-	snprint(buf, n + 1, *str);
+	memcpy(buf, *str, n);
+	buf[n] = 0;
 	*str = p;
 	*nstr -= n;
 	
@@ -862,7 +863,7 @@
 static void
 parsecommit(Object *o)
 {
-	char *p, *t, buf[128];
+	char *p, *t, buf[512];
 	int np;
 
 	p = o->data;
--