X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fnetwork%2Fgethostbyaddr_r.c;h=0f1e61aa0c358a1c7e6fcfc664772e7c77e99c92;hb=d0b547dfb5f7678cab6bc39dd736ed6454357ca4;hp=73e764474a58a2a13542935df98983c66840add0;hpb=70b584bc9467ce939c73898212c17be1ab7e39af;p=musl diff --git a/src/network/gethostbyaddr_r.c b/src/network/gethostbyaddr_r.c index 73e76447..0f1e61aa 100644 --- a/src/network/gethostbyaddr_r.c +++ b/src/network/gethostbyaddr_r.c @@ -18,6 +18,8 @@ int gethostbyaddr_r(const void *a, socklen_t l, int af, socklen_t sl = af==AF_INET6 ? sizeof sa.sin6 : sizeof sa.sin; int i; + *res = 0; + /* Load address argument into sockaddr structure */ if (af==AF_INET6 && l==16) memcpy(&sa.sin6.sin6_addr, a, 16); else if (af==AF_INET && l==4) memcpy(&sa.sin.sin_addr, a, 4); @@ -62,6 +64,7 @@ int gethostbyaddr_r(const void *a, socklen_t l, int af, } h->h_addrtype = af; + h->h_length = l; h->h_name = h->h_aliases[0]; *res = h; return 0;