ruby-changes:50765
From: usa <ko1@a...>
Date: Wed, 28 Mar 2018 14:59:49 +0900 (JST)
Subject: [ruby-changes:50765] usa:r62948 (ruby_2_3): merge revision(s) 60162: [Backport #13994]
usa 2018-03-28 14:59:44 +0900 (Wed, 28 Mar 2018) New Revision: 62948 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62948 Log: merge revision(s) 60162: [Backport #13994] socket.c: null byte at Socket.getnameinfo * ext/socket/socket.c (sock_s_getnameinfo): check null byte. patched by tommy (Masahiro Tomita) in [ruby-dev:50286]. [Bug #13994] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/ext/socket/socket.c branches/ruby_2_3/test/socket/test_socket.rb branches/ruby_2_3/version.h Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 62947) +++ ruby_2_3/version.h (revision 62948) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.7" #define RUBY_RELEASE_DATE "2018-03-28" -#define RUBY_PATCHLEVEL 444 +#define RUBY_PATCHLEVEL 445 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_3/test/socket/test_socket.rb =================================================================== --- ruby_2_3/test/socket/test_socket.rb (revision 62947) +++ ruby_2_3/test/socket/test_socket.rb (revision 62948) @@ -105,6 +105,8 @@ class TestSocket < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/socket/test_socket.rb#L105 def test_getnameinfo assert_raise(SocketError) { Socket.getnameinfo(["AF_UNIX", 80, "0.0.0.0"]) } + assert_raise(ArgumentError) {Socket.getnameinfo(["AF_INET", "http\0", "example.net"])} + assert_raise(ArgumentError) {Socket.getnameinfo(["AF_INET", "http", "example.net\0"])} end def test_ip_address_list Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 62947) +++ ruby_2_3/ChangeLog (revision 62948) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Thu Mar 28 14:59:27 2018 Nobuyoshi Nakada <nobu@r...> + + socket.c: null byte at Socket.getnameinfo + + * ext/socket/socket.c (sock_s_getnameinfo): check null byte. patched by + tommy (Masahiro Tomita) in . [Bug #13994] + Thu Mar 28 14:53:57 2018 Nobuyoshi Nakada <nobu@r...> date_core.c: defensive code Index: ruby_2_3/ext/socket/socket.c =================================================================== --- ruby_2_3/ext/socket/socket.c (revision 62947) +++ ruby_2_3/ext/socket/socket.c (revision 62948) @@ -1287,7 +1287,7 @@ sock_s_getnameinfo(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/socket/socket.c#L1287 hptr = NULL; } else { - strncpy(hbuf, StringValuePtr(host), sizeof(hbuf)); + strncpy(hbuf, StringValueCStr(host), sizeof(hbuf)); hbuf[sizeof(hbuf) - 1] = '\0'; hptr = hbuf; } @@ -1301,7 +1301,7 @@ sock_s_getnameinfo(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/socket/socket.c#L1301 pptr = pbuf; } else { - strncpy(pbuf, StringValuePtr(port), sizeof(pbuf)); + strncpy(pbuf, StringValueCStr(port), sizeof(pbuf)); pbuf[sizeof(pbuf) - 1] = '\0'; pptr = pbuf; } Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 62947) +++ ruby_2_3 (revision 62948) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r60162 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/