Attached is a patch to fix it.
Will be in 1.99 along with some more robust testing that would have
detected this one.
--
Paul Evans
=== modified file 'Socket.xs'
--- Socket.xs 2012-02-12 11:37:51 +0000
+++ Socket.xs 2012-02-16 23:33:47 +0000
@@ -912,17 +912,23 @@
CODE:
#ifdef HAS_INETPTON
int ok;
+ int addrlen = 0;
#ifdef AF_INET6
struct in6_addr ip_address;
#else
struct in_addr ip_address;
#endif
- if (af != AF_INET
+ switch(af) {
+ case AF_INET:
+ addrlen = 4;
+ break;
#ifdef AF_INET6
- && af != AF_INET6
+ case AF_INET6:
+ addrlen = 16;
+ break;
#endif
- ) {
+ default:
croak("Bad address family for %s, got %d, should be"
#ifdef AF_INET6
" either AF_INET or AF_INET6",
@@ -935,7 +941,7 @@
ST(0) = sv_newmortal();
if (ok) {
- sv_setpvn( ST(0), (char *)&ip_address, sizeof(ip_address) );
+ sv_setpvn( ST(0), (char *)&ip_address, addrlen);
}
#else
ST(0) = (SV*)not_here("inet_pton");