* ext/socket/rubysocket.h (SOCKLEN_MAX): Defined.

* ext/socket/raddrinfo.c (ext/socket/raddrinfo.c): Reject too long
  Linux abstract socket name.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-04-17 11:01:17 +00:00
parent cef6a377fc
commit ce6db8f286
3 changed files with 16 additions and 1 deletions

View file

@ -91,6 +91,12 @@
#ifndef HAVE_TYPE_SOCKLEN_T
typedef int socklen_t;
#endif
#define SOCKLEN_MAX \
(0 < (((socklen_t)0)-1) ? \
~(socklen_t)0 : \
(((((socklen_t)1) << (sizeof(socklen_t) * CHAR_BIT - 2)) - 1) * 2 + 1))
#ifndef RSTRING_SOCKLEN
# define RSTRING_SOCKLEN (socklen_t)RSTRING_LENINT
#endif