Skip to content

Commit

Permalink
Be more forgiving with relative paths in search dirs
Browse files Browse the repository at this point in the history
If a search dir is relative and starts by '..', the current code is going
to crash. Instead, accept it without normalizing it.

Change-Id: I4c401cab1b95e60508e8c97341121954899ed7f9
  • Loading branch information
yakobowski committed Jul 8, 2020
1 parent b6b2314 commit 98af858
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion reloc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,11 @@ let normalize_path path =
let rec loop acc path =
match path with
| "." :: path -> loop acc path
| ".." :: path -> loop (List.tl acc) path
| ".." :: path -> begin
match acc with
| _ :: q -> loop q path
| [] -> loop [".."] path
end
| elem :: path -> loop (elem :: acc) path
| [] -> List.rev acc
in
Expand Down

0 comments on commit 98af858

Please sign in to comment.