diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-12 09:16:21 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-12 09:16:21 +0000 |
commit | e74d1eea03dc60a547b14cc5c225e27625f5a893 (patch) | |
tree | 010b14c563f148ed4b0b9acaa5990dbe59b9f2ae /lib | |
parent | cd9e8cb2efe4f04bad41ac39cb58835c7c2bb837 (diff) | |
download | ruby-e74d1eea03dc60a547b14cc5c225e27625f5a893.tar.gz |
* lib/net/ftp.rb (parse_mlsx_entry, mlst) raise an FTPProtoError
when parsing failed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/ftp.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 8bd309b21a..f4f7494a04 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -795,6 +795,9 @@ module Net def parse_mlsx_entry(entry) facts, pathname = entry.split(" ") + unless pathname + raise FTPProtoError, entry + end return MLSxEntry.new( facts.scan(/(.*?)=(.*?);/).each_with_object({}) { |(factname, value), h| @@ -816,7 +819,11 @@ module Net if !resp.start_with?("250") raise FTPReplyError, resp end - entry = resp.lines[1].sub(/\A(250-| *)/, "") + line = resp.lines[1] + unless line + raise FTPProtoError, resp + end + entry = line.sub(/\A(250-| *)/, "") return parse_mlsx_entry(entry) end |