From f6d228c20ee984482f75a88f57d92587138ba13f Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Thu, 8 Apr 1999 23:13:23 +0000 Subject: [PATCH] oops, fixed another goof --- citadel/locate_host.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/citadel/locate_host.c b/citadel/locate_host.c index 2860c6a82..69080d709 100644 --- a/citadel/locate_host.c +++ b/citadel/locate_host.c @@ -24,7 +24,7 @@ void locate_host(char *tbuf, const struct in_addr *addr) { - struct hostent *ch, *ch2; + struct hostent *ch; char *i; int a1, a2, a3, a4; @@ -45,12 +45,15 @@ void locate_host(char *tbuf, const struct in_addr *addr) section */ } /* check if the forward DNS agrees; if not, they're spoofing */ - if ((ch2 = gethostbyname(ch->h_name)) == NULL) + i = strdup(ch->h_name); + ch = gethostbyname(i); + free(i); + if (ch == NULL) goto bad_dns; /* check address for consistency */ - for (; *ch2->h_addr_list; ch2->h_addr_list++) - if (!memcmp(*ch2->h_addr_list, addr, + for (; *ch->h_addr_list; ch->h_addr_list++) + if (!memcmp(*ch->h_addr_list, addr, sizeof *addr)) { strncpy(tbuf, ch->h_name, 24); goto end; -- 2.39.2