[前][次][番号順一覧][スレッド一覧]

ruby-changes:43800

From: usa <ko1@a...>
Date: Fri, 12 Aug 2016 11:43:41 +0900 (JST)
Subject: [ruby-changes:43800] usa:r55873 (ruby_2_2): merge revision(s) 55579: [Backport #12556]

usa	2016-08-12 11:43:36 +0900 (Fri, 12 Aug 2016)

  New Revision: 55873

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55873

  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_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/lib/net/ftp.rb
    branches/ruby_2_2/test/net/ftp/test_ftp.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/test/net/ftp/test_ftp.rb
===================================================================
--- ruby_2_2/test/net/ftp/test_ftp.rb	(revision 55872)
+++ ruby_2_2/test/net/ftp/test_ftp.rb	(revision 55873)
@@ -815,8 +815,17 @@ class FTPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/net/ftp/test_ftp.rb#L815
     end
   end
 
-  private
+  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)
     server = TCPServer.new(SERVER_ADDR, 0)
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 55872)
+++ ruby_2_2/version.h	(revision 55873)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.6"
 #define RUBY_RELEASE_DATE "2016-08-12"
-#define RUBY_PATCHLEVEL 345
+#define RUBY_PATCHLEVEL 346
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 8
Index: ruby_2_2/lib/net/ftp.rb
===================================================================
--- ruby_2_2/lib/net/ftp.rb	(revision 55872)
+++ ruby_2_2/lib/net/ftp.rb	(revision 55873)
@@ -280,6 +280,9 @@ module Net https://github.com/ruby/ruby/blob/trunk/ruby_2_2/lib/net/ftp.rb#L280
       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_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 55872)
+++ ruby_2_2/ChangeLog	(revision 55873)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Fri Aug 12 11:41:41 2016  Shugo Maeda  <shugo@r...>
+
+	* lib/net/ftp.rb (putline): raise an ArgumentError when
+	  CR or LF is included in a line.
+
 Fri Aug 12 11:21:24 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* string.c (tr_trans): consider terminator length and fix heap

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r55579


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]