aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-07-13 16:38:30 -0500
committerJack Nagel2013-07-13 16:56:43 -0500
commit411d0647258de1b54483492d949565daf41282af (patch)
tree6d8cb0b394ad172f7fe3b477e72aab3d155d0d50 /Library
parent354d60c4c3fdef6b4a2a13d40d023c28994b64cf (diff)
downloadhomebrew-411d0647258de1b54483492d949565daf41282af.tar.bz2
Handle NULs in link targets in Pathname#resolved_path_exists?
Fixes #19475. Fixes #21184.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/pathname.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 6e582c703..3d9fa4c94 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -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