Handle NULs in link targets in Pathname#resolved_path_exists?

Fixes Homebrew/homebrew#19475.
Fixes Homebrew/homebrew#21184.
This commit is contained in:
Jack Nagel 2013-07-13 16:38:30 -05:00
parent 7964aa6648
commit 528e750f7b

View File

@ -253,7 +253,12 @@ class Pathname
end
def resolved_path_exists?
(dirname+readlink).exist?
link = readlink
rescue ArgumentError
# The link target contains NUL bytes
false
else
(dirname+link).exist?
end
# perhaps confusingly, this Pathname object becomes the symlink pointing to