diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-27 11:07:57 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-05-27 11:07:57 +0000 |
commit | aa37cc71279123d870263f9e9b315e7fd48095eb (patch) | |
tree | cfd4006c9bae86d3b25162636ac0abd24a226ac1 /ext/socket/socket.c | |
parent | 771240704854bd767f5873fa4199966f756f5b93 (diff) | |
download | ruby-aa37cc71279123d870263f9e9b315e7fd48095eb.tar.gz |
* ext/socket/socket.c (sock_addrinfo): get rid of SEGV at NULL ptr
String. increase buffer size for 64bit platforms.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 039d7b006b..0198a8e1d6 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -553,7 +553,7 @@ sock_addrinfo(host, port, socktype, flags) struct addrinfo hints, *hintsp, *res; char *hostp, *portp; int error; - char hbuf[1024], pbuf[16]; + char hbuf[1024], pbuf[32]; if (NIL_P(host)) { hostp = NULL; @@ -569,7 +569,7 @@ sock_addrinfo(host, port, socktype, flags) SafeStringValue(host); name = RSTRING(host)->ptr; - if (*name == 0 || (name[0] == '<' && strcmp(name, "<any>") == 0)) { + if (!name || *name == 0 || (name[0] == '<' && strcmp(name, "<any>") == 0)) { mkinetaddr(INADDR_ANY, hbuf, sizeof(hbuf)); } else if (name[0] == '<' && strcmp(name, "<broadcast>") == 0) { |