git: 9front

Download patch

ref: 5e3253630ecb04717ef58d2c0fcde157d41f0732
parent: 3a443f6393e2eb0ef20bd54dcb731cf3478ea1f8
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;
--