зеркало из https://github.com/github/ruby.git
* ext/socket/ipsocket.c (ip_s_getaddress): Don't access freed memory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
2c36345ad6
Коммит
948ce9decb
|
@ -1,3 +1,7 @@
|
|||
Wed Feb 19 17:47:01 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/ipsocket.c (ip_s_getaddress): Don't access freed memory.
|
||||
|
||||
Wed Feb 19 11:39:41 2014 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* configure.in: it must see rb_cv_broken_memmem not rb_cv_func_memmem.
|
||||
|
|
|
@ -305,12 +305,13 @@ ip_s_getaddress(VALUE obj, VALUE host)
|
|||
{
|
||||
union_sockaddr addr;
|
||||
struct addrinfo *res = rsock_addrinfo(host, Qnil, SOCK_STREAM, 0);
|
||||
socklen_t len = res->ai_addrlen;
|
||||
|
||||
/* just take the first one */
|
||||
memcpy(&addr, res->ai_addr, res->ai_addrlen);
|
||||
memcpy(&addr, res->ai_addr, len);
|
||||
freeaddrinfo(res);
|
||||
|
||||
return rsock_make_ipaddr(&addr.addr, res->ai_addrlen);
|
||||
return rsock_make_ipaddr(&addr.addr, len);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче