gethostbyname("#.#.#.#") should fail; not return an incompletely and
authorderaadt <deraadt@openbsd.org>
Mon, 20 Nov 1995 09:34:33 +0000 (09:34 +0000)
committerderaadt <deraadt@openbsd.org>
Mon, 20 Nov 1995 09:34:33 +0000 (09:34 +0000)
incorrectly initialized hostent. in particular, h_name is supposed to
be `an official name', and gethostbyname() wasn't even trying to meet
that requirement.

lib/libc/net/gethostnamadr.c

index ec3f14a..2c05958 100644 (file)
@@ -270,6 +270,7 @@ gethostbyname(name)
        register struct hostent *hp;
        char lookups[MAXDNSLUS];
 
+#ifdef insecure
        /*
         * disallow names consisting only of digits/dots, unless
         * they end in a dot.
@@ -301,6 +302,7 @@ gethostbyname(name)
                        if (!isdigit(*cp) && *cp != '.') 
                                break;
                }
+#endif
 
        if ((_res.options & RES_INIT) == 0 && res_init() == -1)
                return (_gethtbyname(name));