Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d36e14

Browse files
committed
Merge pull request libgit2#3534 from ethomson/index_canonicalize_fix
index: canonicalize inserted paths safely
2 parents 15e6a5a + 626f9e2 commit 2d36e14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ static int canonicalize_directory_path(
11671167
while ((match = git_vector_get(&index->entries, pos))) {
11681168
if (GIT_IDXENTRY_STAGE(match) != 0) {
11691169
/* conflicts do not contribute to canonical paths */
1170-
} else if (memcmp(search, match->path, search_len) == 0) {
1170+
} else if (strncmp(search, match->path, search_len) == 0) {
11711171
/* prefer an exact match to the input filename */
11721172
best = match;
11731173
best_len = search_len;

0 commit comments

Comments
 (0)