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

ruby-changes:41187

From: normal <ko1@a...>
Date: Wed, 23 Dec 2015 07:28:59 +0900 (JST)
Subject: [ruby-changes:41187] normal:r53259 (trunk): ext/socket/init.c (rsock_init_sock): reject reserved FDs

normal	2015-12-23 07:28:31 +0900 (Wed, 23 Dec 2015)

  New Revision: 53259

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

  Log:
    ext/socket/init.c (rsock_init_sock): reject reserved FDs
    
    [ruby-core:72445] [Bug #11862]

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/init.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53258)
+++ ChangeLog	(revision 53259)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Dec 23 07:15:17 2015  Eric Wong  <e@8...>
+
+	* ext/socket/init.c (rsock_init_sock): reject reserved FDs
+	  [ruby-core:72445] [Bug #11862]
+
 Wed Dec 23 02:59:26 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (__STDC_WANT_LIB_EXT1__): necessary to use memset_s
Index: ext/socket/init.c
===================================================================
--- ext/socket/init.c	(revision 53258)
+++ ext/socket/init.c	(revision 53259)
@@ -61,7 +61,7 @@ rsock_init_sock(VALUE sock, int fd) https://github.com/ruby/ruby/blob/trunk/ext/socket/init.c#L61
 {
     rb_io_t *fp;
 
-    if (!is_socket(fd)) {
+    if (!is_socket(fd) || rb_reserved_fd_p(fd)) {
 	errno = EBADF;
 	rb_sys_fail("not a socket file descriptor");
     }

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

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