shithub: git9

Download patch

ref: dc13da152b281f506784d80f594350f08df2a95d
parent: 2f1fb4622ad0634824c23051e42bf244ac604227
author: Ori Bernstein <[email protected]>
date: Mon Jan 18 14:41:52 EST 2021

git/send: init the capability set every time (thanks Igor Boehm).

There's an issue where we can read things out of an uninitialized
capset, either via an early flush packet or a lack of capabilities.
Always clearing the capset fixes this.

--- a/send.c
+++ b/send.c
@@ -82,7 +82,6 @@
 {
 	char *p, *n;
 
-	memset(cs, 0, sizeof(Capset));
 	for(p = caps; p != nil; p = n){
 		n = strchr(p, ' ');
 		if(n != nil)
@@ -107,6 +106,7 @@
 	Capset cs;
 
 	first = 1;
+	memset(&cs, 0, sizeof(Capset));
 	nupd = readours(&ours, &refs);
 	theirs = eamalloc(nupd, sizeof(Hash));
 	while(1){