diff --git a/utils.c b/utils.c
index d73e76e626f52c79aa36bffb99225a50ed5e27be..dca0dfd492fb6834dfa08258bf7603405298f35e 100755
--- a/utils.c
+++ b/utils.c
@@ -191,7 +191,9 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp)
 		/* Forge a reply for IP's to avoid octal IP's being interpreted as octal */
 		if (dots != 3)
 			return NULL;
-		hp->hp.h_addr = hp->buf;
+		memset(hp, 0, sizeof(struct ast_hostent));
+		hp->hp.h_addr_list = hp->buf;
+		hp->hp.h_addr = hp->buf + sizeof(void *);
 		if (inet_pton(AF_INET, host, hp->hp.h_addr) > 0)
 			return &hp->hp;
 		return NULL;