cache_tree_find(): find the end of path component using strchrnul()