Merge pull request #7120 from xokdvium/refspec-del

refspec: Detect DEL character in is_valid_name
This commit is contained in:
Edward Thomson
2025-12-06 17:54:52 +00:00
committed by GitHub
2 changed files with 2 additions and 1 deletions

View File

@@ -819,7 +819,7 @@ int git_reference_list(
static int is_valid_ref_char(char ch)
{
if ((unsigned) ch <= ' ')
if ((unsigned) ch <= ' ' || ch == '\177') /* ASCII control characters */
return 0;
switch (ch) {

View File

@@ -21,6 +21,7 @@ void test_refs_isvalidname__can_detect_invalid_formats(void)
cl_assert_equal_i(false, is_valid_name("/"));
cl_assert_equal_i(false, is_valid_name("//"));
cl_assert_equal_i(false, is_valid_name(""));
cl_assert_equal_i(false, is_valid_name("refs/heads/\177"));
cl_assert_equal_i(false, is_valid_name("refs/heads/sub.lock/webmatrix"));
}