diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ext/socket/init.c | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Wed Dec 23 07:15:17 2015 Eric Wong <e@80x24.org> + + * 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@ruby-lang.org> * configure.in (__STDC_WANT_LIB_EXT1__): necessary to use memset_s diff --git a/ext/socket/init.c b/ext/socket/init.c index bc01217641..66da534a58 100644 --- a/ext/socket/init.c +++ b/ext/socket/init.c @@ -61,7 +61,7 @@ rsock_init_sock(VALUE sock, int fd) { 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"); } |