Commit Diff


commit - 5d79cba5f44776394c0437df6fee96a5eb2e34df
commit + 99fda3ad1a9cbd1e892c591fa2ce9e2b3b979552
blob - 60e6716c7c18c43357950acbac0fa9eff47dd59f
blob + c32bcc116c752ace694e6fa1a3f118abd3c5ec4a
--- lib/fileindex.c
+++ lib/fileindex.c
@@ -548,9 +548,9 @@ got_fileindex_read(struct got_fileindex *fileindex, FI
 }
 
 static int
-in_same_subdir(struct got_fileindex_entry *ie, const char *parent_path)
+in_same_subdir(struct got_fileindex_entry *ie, const char *parent_path,
+    size_t parent_len)
 {
-	size_t parent_len = strlen(parent_path);
 	char *ie_name;
 
 	if (!got_path_is_child(ie->path, parent_path, parent_len))
@@ -572,7 +572,7 @@ cmp_entries(struct got_fileindex_entry *ie, const char
     size_t parent_len, struct got_tree_entry *te)
 {
 	int cmp = strncmp(ie->path, parent_path, parent_len);
-	if (cmp == 0 || in_same_subdir(ie, parent_path)) {
+	if (cmp == 0 || in_same_subdir(ie, parent_path, parent_len)) {
 		char *ie_name = ie->path + parent_len;
 		while (ie_name[0] == '/')
 			ie_name++;