shithub: riscv

Download patch

ref: b049bb81adf2e6b0e2ef30973195a5ced06d2185
parent: 752405d853d96a39199328110bce0fe5c6299e27
author: Jacob Moody <moody@posixcafe.org>
date: Sun Feb 16 00:47:51 EST 2025

git/pull: more reference name validation (thanks falsifian)

// and ^. are also disallowed

--- a/sys/src/cmd/git/util.c
+++ b/sys/src/cmd/git/util.c
@@ -528,7 +528,7 @@
 	char *p;
 
 	slashed = 0;
-	if(*ref == '/')
+	if(*ref == '/' || *ref == '.')
 		return 0;
 	for(p = ref; *p != 0; p++) {
 		switch(*p){
@@ -539,7 +539,7 @@
 				return 0;
 			break;
 		case '/':
-			if(p[1] == 0 || p[1] == '.')
+			if(p[1] == 0 || p[1] == '.' || p[1] == '/')
 				return 0;
 			slashed = 1;
 			break;
--