Skip to content

Commit e91311e

Browse files
committed
hostent2su: copy hostnames into sockaddr_union_struct
1 parent 0209363 commit e91311e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ip_addr.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,11 @@ static inline int hostent2su( struct sockaddr_union_struct* su,
366366
unsigned short port )
367367
{
368368
memset(su, 0, sizeof(struct sockaddr_union_struct)); /*needed on freebsd*/
369+
370+
/* copy the hostname into the sockaddr_union_struct */
371+
strncpy(su->hostname, he->h_name, sizeof(su->hostname)-1);
372+
su->hostname[sizeof(su->hostname)-1] = 0;
373+
369374
su->u.s.sa_family=he->h_addrtype;
370375
switch(he->h_addrtype){
371376
case AF_INET6:

0 commit comments

Comments
 (0)