Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2013-03-07 19:38:44 +0400
committerCarlos Martín Nieto <cmn@elego.de>2013-03-07 19:38:44 +0400
commitbb45c57f94d3c7c96e78234e2a81393c0ced45a0 (patch)
treee501f5be5296ce8d894e69867eb511a6be81fa27 /src/refs.c
parent9952f24e6cc71ef5ecd13831f783e308aae97c36 (diff)
refs: explicitly catch leading slashes
It's somewhat common to try to write "/refs/tags/something". There is no easy way to catch it during the main body of the function, as there is no way to distinguish whether it's a leading slash or a double slash somewhere in the middle. Catch this at the beginning so we don't trigger the assert in is_all_caps_and_underscore().
Diffstat (limited to 'src/refs.c')
-rw-r--r--src/refs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/refs.c b/src/refs.c
index 113cadad5..dd3dd64b1 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1667,6 +1667,9 @@ int git_reference__normalize_name(
process_flags = flags;
current = (char *)name;
+ if (*current == '/')
+ goto cleanup;
+
if (normalize)
git_buf_clear(buf);