Permalink
Browse files

ares_getnameinfo: fix random results with c-ares 1.7.5

In ares_getnameinfo memcpy did not copy enough bytes, causing
it to return arbitrary memory contents as a result.
  • Loading branch information...
denik authored and yangtse committed Aug 24, 2011
1 parent c8d8ca2 commit 1f8f14d21ebfcddd18c6c7ba7c74a160b64575ac
Showing with 2 additions and 2 deletions.
  1. +2 −2 ares_getnameinfo.c
View
@@ -188,15 +188,15 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
if (sa->sa_family == AF_INET)
{
niquery->family = AF_INET;
- memcpy(&niquery->addr.addr4, addr, sizeof(struct in_addr));
+ memcpy(&niquery->addr.addr4, addr, sizeof(niquery->addr.addr4));
ares_gethostbyaddr(channel, &addr->sin_addr,
sizeof(struct in_addr), AF_INET,
nameinfo_callback, niquery);
}
else
{
niquery->family = AF_INET6;
- memcpy(&niquery->addr.addr6, addr6, sizeof(struct ares_in6_addr));
+ memcpy(&niquery->addr.addr6, addr6, sizeof(niquery->addr.addr6));
ares_gethostbyaddr(channel, &addr6->sin6_addr,
sizeof(struct ares_in6_addr), AF_INET6,
nameinfo_callback, niquery);

0 comments on commit 1f8f14d

Please sign in to comment.