From 777c719450311f27d1cf67ef0afc60c953cefe9d Mon Sep 17 00:00:00 2001 From: shugo Date: Sat, 12 Sep 2015 09:16:21 +0000 Subject: * 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 --- lib/net/ftp.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3