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

merge revision(s) r49543,r49557: [Backport #10854]

* ext/socket/getaddrinfo.c (get_addr): reject too long hostname to
	  get rid of GHOST vulnerability on very old platforms.

	* ext/socket/raddrinfo.c (make_hostent_internal): ditto, paranoic
	  check for the canonnical name.
	  check for the canonical name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@49600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2015-02-14 22:36:43 +00:00
parent 40705c2be1
commit 8e210f995f
4 changed files with 14 additions and 4 deletions

View file

@ -1,3 +1,11 @@
Sun Feb 15 07:29:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/socket/getaddrinfo.c (get_addr): reject too long hostname to
get rid of GHOST vulnerability on very old platforms.
* ext/socket/raddrinfo.c (make_hostent_internal): ditto, paranoic
check for the canonical name.
Mon Feb 2 22:57:30 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/etc/etc.c (etc_getlogin): set login name encoding properly.

View file

@ -593,6 +593,7 @@ get_addr(const char *hostname, int af, struct addrinfo **res, struct addrinfo *p
} else
hp = getipnodebyname(hostname, af, AI_ADDRCONFIG, &h_error);
#else
if (strlen(hostname) >= NI_MAXHOST) ERR(EAI_NODATA);
hp = gethostbyname((char*)hostname);
h_error = h_errno;
#endif

View file

@ -617,7 +617,8 @@ make_hostent_internal(struct hostent_arg *arg)
}
rb_ary_push(ary, rb_str_new2(hostp));
if (addr->ai_canonname && (h = gethostbyname(addr->ai_canonname))) {
if (addr->ai_canonname && strlen(addr->ai_canonname) < NI_MAXHOST &&
(h = gethostbyname(addr->ai_canonname))) {
names = rb_ary_new();
if (h->h_aliases != NULL) {
for (pch = h->h_aliases; *pch; pch++) {

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.1.5"
#define RUBY_RELEASE_DATE "2015-02-13"
#define RUBY_PATCHLEVEL 292
#define RUBY_RELEASE_DATE "2015-02-15"
#define RUBY_PATCHLEVEL 293
#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 2
#define RUBY_RELEASE_DAY 13
#define RUBY_RELEASE_DAY 15
#include "ruby/version.h"