match tree entries exactly, not by prefix, in find_entry_by_name()
diff --git a/lib/object.c b/lib/object.c
index b794b8e..77ebb79 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -714,7 +714,8 @@ find_entry_by_name(struct got_tree_object *tree, const char *name, size_t len)
struct got_tree_entry *te;
SIMPLEQ_FOREACH(te, &tree->entries.head, entry) {
- if (strncmp(te->name, name, len) == 0)
+ if (strlen(te->name) == len &&
+ strncmp(te->name, name, len) == 0)
return te;
}
return NULL;