Merge pull request #3534 from ethomson/index_canonicalize_fix

index: canonicalize inserted paths safely
This commit is contained in:
Carlos Martín Nieto 2015-12-03 23:37:37 +01:00
commit 2d36e145d9

View File

@ -1167,7 +1167,7 @@ static int canonicalize_directory_path(
while ((match = git_vector_get(&index->entries, pos))) {
if (GIT_IDXENTRY_STAGE(match) != 0) {
/* 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 */
best = match;
best_len = search_len;