1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) 53259: [Backport #11862]

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@53924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2016-02-25 08:50:44 +00:00
parent c9eefd5644
commit af3ab0bb2c
3 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Thu Feb 25 17:48:16 2016 Eric Wong <e@80x24.org>
* ext/socket/init.c (rsock_init_sock): reject reserved FDs
[ruby-core:72445] [Bug #11862]
Thu Feb 25 17:38:59 2016 Eric Wong <e@80x24.org>
* ext/socket/init.c (rsock_init_sock): check FD after validating

View file

@ -48,12 +48,12 @@ rsock_init_sock(VALUE sock, int fd)
if (fstat(fd, &sbuf) < 0)
rb_sys_fail("fstat(2)");
if (!S_ISSOCK(sbuf.st_mode)) {
if (!S_ISSOCK(sbuf.st_mode) || rb_reserved_fd_p(fd)) {
errno = EBADF;
rb_sys_fail("not a socket file descriptor");
}
#else
if (!rb_w32_is_socket(fd)) {
if (!rb_w32_is_socket(fd) || rb_reserved_fd_p(fd)) {
errno = EBADF;
rb_sys_fail("not a socket file descriptor");
}

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.9"
#define RUBY_RELEASE_DATE "2016-02-25"
#define RUBY_PATCHLEVEL 445
#define RUBY_PATCHLEVEL 446
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 2