diff --git a/src/glob.ml b/src/glob.ml index 19ce3df..17539a3 100644 --- a/src/glob.ml +++ b/src/glob.ml @@ -197,6 +197,9 @@ let matches ?options glob path = ignore options; let rec matches i path = function | [] -> Int.equal (String.length path) i + | (Dir_sep | String _ | Question | Range _ | Complement _) :: _ + when i >= String.length path -> + false | Dir_sep :: rest -> let b = Char.equal (String.get path i) glob.dir_sep in b && matches (i + 1) path rest