diff options
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index abce61307a..33b47451fd 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -826,7 +826,10 @@ sock_sysaccept(VALUE sock) static VALUE sock_gethostname(VALUE obj) { - char buf[1024]; +#ifndef HOST_NAME_MAX +# define HOST_NAME_MAX 1024 +#endif + char buf[HOST_NAME_MAX+1]; rb_secure(3); if (gethostname(buf, (int)sizeof buf - 1) < 0) |