diff options
| author | Jack Nagel | 2013-07-13 16:38:30 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-07-13 16:56:43 -0500 |
| commit | 528e750f7be39e0f747fcfd0398763346d09097a (patch) | |
| tree | 0cf7b0e337cb3d8d299c9c9a393dcd84632666bc /Library | |
| parent | 7964aa6648362f55df29696eb8710c67e11bb1a0 (diff) | |
| download | brew-528e750f7be39e0f747fcfd0398763346d09097a.tar.bz2 | |
Handle NULs in link targets in Pathname#resolved_path_exists?
Fixes Homebrew/homebrew#19475.
Fixes Homebrew/homebrew#21184.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 7 |
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 |
