ruby-changes:43838
From: nagachika <ko1@a...>
Date: Tue, 16 Aug 2016 04:56:25 +0900 (JST)
Subject: [ruby-changes:43838] nagachika:r55911 (ruby_2_3): merge revision(s) 55579: [Backport #12556]
nagachika 2016-08-16 04:56:19 +0900 (Tue, 16 Aug 2016) New Revision: 55911 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55911 Log: merge revision(s) 55579: [Backport #12556] * lib/net/ftp.rb (putline): raise an ArgumentError when CR or LF is included in a line. Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/lib/net/ftp.rb branches/ruby_2_3/test/net/ftp/test_ftp.rb branches/ruby_2_3/version.h Index: ruby_2_3/test/net/ftp/test_ftp.rb =================================================================== --- ruby_2_3/test/net/ftp/test_ftp.rb (revision 55910) +++ ruby_2_3/test/net/ftp/test_ftp.rb (revision 55911) @@ -1633,6 +1633,16 @@ EOF https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/net/ftp/test_ftp.rb#L1633 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) Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 55910) +++ ruby_2_3/ChangeLog (revision 55911) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Tue Aug 16 04:54:12 2016 Shugo Maeda <shugo@r...> + + * 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@r...> * ext/date/date_strftime.c (date_strftime_with_tmx): reject too Index: ruby_2_3/lib/net/ftp.rb =================================================================== --- ruby_2_3/lib/net/ftp.rb (revision 55910) +++ ruby_2_3/lib/net/ftp.rb (revision 55911) @@ -295,6 +295,9 @@ module Net https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/net/ftp.rb#L295 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 Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 55910) +++ ruby_2_3/version.h (revision 55911) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #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 Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r55579 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/