summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-23 12:42:58 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-23 12:42:58 +0000
commit206a79807d945fb4c06291a7ca718c890de8aaff (patch)
treebac4d8a5ee750e6cef75dede14923ae187bdd69a /ext
parentf40c637794ebd9f20c56f51e3aa5c10130421754 (diff)
merge revision(s) 60162: [Backport #13994]
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/branches/ruby_2_4@62904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/socket.c4
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;
}