Handle NULs in link targets in Pathname#resolved_path_exists?
Fixes Homebrew/homebrew#19475. Fixes Homebrew/homebrew#21184.
This commit is contained in:
parent
7964aa6648
commit
528e750f7b
@ -253,7 +253,12 @@ class Pathname
|
|||||||
end
|
end
|
||||||
|
|
||||||
def resolved_path_exists?
|
def resolved_path_exists?
|
||||||
(dirname+readlink).exist?
|
link = readlink
|
||||||
|
rescue ArgumentError
|
||||||
|
# The link target contains NUL bytes
|
||||||
|
false
|
||||||
|
else
|
||||||
|
(dirname+link).exist?
|
||||||
end
|
end
|
||||||
|
|
||||||
# perhaps confusingly, this Pathname object becomes the symlink pointing to
|
# perhaps confusingly, this Pathname object becomes the symlink pointing to
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user