Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jun 2003 18:54:59 -0700
From:      Kris Kennaway <kris@obsecurity.org>
To:        current@FreeBSD.org, julian@FreeBSD.org
Subject:   Bogus "temporary" gethostbyaddr_r() in libc for 6 years
Message-ID:  <20030616015459.GA35478@rot13.obsecurity.org>

next in thread | raw e-mail | index | archive | help

--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

There's a bogus implementation of gethostbyaddr_r() in
lib/libc/net/gethostnamadr.c that was committed 6 years and nine
months ago:

/*
 * Temporary function (not thread safe)
 */
int gethostbyaddr_r(const char *addr, int len, int type,
        struct hostent *result, struct hostent_data *buffer)
{
        struct hostent *hp;
        int ret;
        if ((hp = gethostbyaddr(addr, len, type)) == NULL) {
                ret = -1;
        } else {
                memcpy(result, hp, sizeof(struct hostent));
                ret = 0;
        }
        return(ret);
}

What's the deal here? Despite the fact that this is not prototyped in
a header, some ports are detecting this, and -- one assumes -- not
behaving correctly since this implementation isn't thread-safe.

Kris

--ew6BAiZeqk4r7MaW
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQE+7SNyWry0BWjoQKURAsNSAJ0Q0gIQ7pAeJCK7Y5Mq8nwBKiD2OACgke/Z
4ZXfqwrGkAggEonA20rgVNw=
=Mpmp
-----END PGP SIGNATURE-----

--ew6BAiZeqk4r7MaW--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030616015459.GA35478>