diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-11 06:16:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-11 06:16:04 +0000 |
commit | fb89004a3bb6806b3b571a0592837c0d105e3e61 (patch) | |
tree | 3929464079f7d8c1c032ec96e070c1baf7411ac0 /ext | |
parent | 0c551b7a6de46e54e4c273c4b7959aae362d5aa2 (diff) |
socket.c: null byte at Socket.getnameinfo
* ext/socket/socket.c (sock_s_getnameinfo): check null byte.
patched by tommy (Masahiro Tomita) in [ruby-dev:50286].
[Bug #13994]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-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 14e069bb8d..9eb36def14 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -1287,7 +1287,7 @@ sock_s_getnameinfo(int argc, VALUE *argv) hptr = NULL; } else { - strncpy(hbuf, StringValuePtr(host), sizeof(hbuf)); + strncpy(hbuf, StringValueCStr(host), sizeof(hbuf)); hbuf[sizeof(hbuf) - 1] = '\0'; hptr = hbuf; } @@ -1301,7 +1301,7 @@ sock_s_getnameinfo(int argc, VALUE *argv) pptr = pbuf; } else { - strncpy(pbuf, StringValuePtr(port), sizeof(pbuf)); + strncpy(pbuf, StringValueCStr(port), sizeof(pbuf)); pbuf[sizeof(pbuf) - 1] = '\0'; pptr = pbuf; } |