Commit 2d36e145 by Carlos Martín Nieto

Merge pull request #3534 from ethomson/index_canonicalize_fix

index: canonicalize inserted paths safely
parents 15e6a5af 626f9e24
...@@ -1167,7 +1167,7 @@ static int canonicalize_directory_path( ...@@ -1167,7 +1167,7 @@ static int canonicalize_directory_path(
while ((match = git_vector_get(&index->entries, pos))) { while ((match = git_vector_get(&index->entries, pos))) {
if (GIT_IDXENTRY_STAGE(match) != 0) { if (GIT_IDXENTRY_STAGE(match) != 0) {
/* conflicts do not contribute to canonical paths */ /* conflicts do not contribute to canonical paths */
} else if (memcmp(search, match->path, search_len) == 0) { } else if (strncmp(search, match->path, search_len) == 0) {
/* prefer an exact match to the input filename */ /* prefer an exact match to the input filename */
best = match; best = match;
best_len = search_len; best_len = search_len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment