merge revision(s) 55579: [Backport #12556]

* lib/net/ftp.rb (putline): raise an ArgumentError when
	  CR or LF is included in a line.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2016-08-15 19:56:19 +00:00
parent 38e722f741
commit 94231bdf79
4 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Tue Aug 16 04:54:12 2016 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (putline): raise an ArgumentError when
CR or LF is included in a line.
Tue Aug 16 04:38:48 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/date/date_strftime.c (date_strftime_with_tmx): reject too

View file

@ -295,6 +295,9 @@ module Net
if @debug_mode
print "put: ", sanitize(line), "\n"
end
if /[\r\n]/ =~ line
raise ArgumentError, "A line must not contain CR or LF"
end
line = line + CRLF
@sock.write(line)
end

View file

@ -1633,6 +1633,16 @@ EOF
end
end
def test_putline_reject_crlf
ftp = Net::FTP.new
assert_raise(ArgumentError) do
ftp.send(:putline, "\r")
end
assert_raise(ArgumentError) do
ftp.send(:putline, "\n")
end
end
private
def create_ftp_server(sleep_time = nil)

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.3.2"
#define RUBY_RELEASE_DATE "2016-08-16"
#define RUBY_PATCHLEVEL 161
#define RUBY_PATCHLEVEL 162
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 8