Merge pull request #3534 from ethomson/index_canonicalize_fix index: canonicalize inserted paths safely
diff --git a/src/index.c b/src/index.c
index ca5b2c4..391738e 100644
--- a/src/index.c
+++ b/src/index.c
@@ -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;