]> code.citadel.org Git - citadel.git/blobdiff - citadel/locate_host.c
* locate_host.c: use strdoop() and phree() instead of strdup() and free()
[citadel.git] / citadel / locate_host.c
index 69080d709f38d9228a9ab722ea9ebb8e09e222f6..5731e5d76b3809157c1b9d84c1508562cda1a600 100644 (file)
@@ -45,9 +45,9 @@ void locate_host(char *tbuf, const struct in_addr *addr)
                                   section */
        }
        /* check if the forward DNS agrees; if not, they're spoofing */
-       i = strdup(ch->h_name);
+       i = strdoop(ch->h_name);
        ch = gethostbyname(i);
-       free(i);
+       phree(i);
        if (ch == NULL)
                goto bad_dns;
 
@@ -55,7 +55,7 @@ void locate_host(char *tbuf, const struct in_addr *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);
+                       safestrncpy(tbuf, ch->h_name, 24);
                        goto end;
                }
        goto bad_dns;           /* they were spoofing. report a numeric IP