Fix broken net_address_to_string().

This commit is contained in:
Jan Vidar Krey 2010-01-22 16:09:19 +01:00
parent 1bb3bd90c1
commit 4711d26c11

View File

@ -526,12 +526,15 @@ const char* net_address_to_string(int af, const void* src, char* dst, socklen_t
return NULL; return NULL;
#else #else
const char* address = inet_ntop(af, src, dst, cnt); if (inet_ntop(af, src, dst, cnt))
if (af == AF_INET6 && strncmp(address, "::ffff:", 7) == 0) /* IPv6 mapped IPv4 address. */
{ {
return &address[7]; if (af == AF_INET6 && strncmp(dst, "::ffff:", 7) == 0) /* IPv6 mapped IPv4 address. */
{
memmove(dst, dst + 7, cnt - 7);
} }
return address; return dst;
}
return NULL;
#endif #endif
} }