Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Nov 2000 14:11:35 -0800
From:      Kris Kennaway <kris@FreeBSD.ORG>
To:        =?iso-8859-1?Q?Joachim_Str=F6mbergson?= <watchman@ludd.luth.se>
Cc:        Kris Kennaway <kris@citusc.usc.edu>, audit@FreeBSD.ORG
Subject:   Re: format_ip_addr() in libatm
Message-ID:  <20001127141135.B66576@citusc17.usc.edu>
In-Reply-To: <3A22D5DA.D5F4BAA7@ludd.luth.se>; from watchman@ludd.luth.se on Mon, Nov 27, 2000 at 10:44:58PM %2B0100
References:  <20001126150832.A40399@citusc17.usc.edu> <3A22D5DA.D5F4BAA7@ludd.luth.se>

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

--f2QGlHpHGjS2mn6Y
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Nov 27, 2000 at 10:44:58PM +0100, Joachim Str=F6mbergson wrote:

> > Index: ip_addr.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > RCS file: /mnt/ncvs/src/lib/libatm/ip_addr.c,v
> > retrieving revision 1.3
> > diff -u -r1.3 ip_addr.c
> > --- ip_addr.c   1999/08/27 23:58:04     1.3
> > +++ ip_addr.c   2000/11/26 22:58:37
> > @@ -124,7 +124,7 @@
> >  format_ip_addr(addr)
> >         struct in_addr  *addr;
> >  {
> > -       static char     host_name[128];
> > +       static char     host_name[MAXHOSTNAMELEN + 18];
> >         char            *ip_num;
> >         struct hostent  *ip_host;
>=20
> I might be waaay off from what you are hinting at here but...
> Is this a patch by you that sets the size of host_name to
> MAXHOSTNAMELEN+18, or is this somebody elses patch that you consider
> bad?
>=20
> If it's the latter, then why the extra 18 bytes?=20
> Otherwise, I didn't see any probs... The disclaimer being my (in)ability
> to perfectly grasp C code.

It's my patch. The current code allocates 128 bytes and tries to fit a
DNS hostname (which can be up to MAXHOSTNAMELEN=3D256 characters long,
including terminating NULL) plus 18 bytes of other stuff in there (IP
address, mostly). The DNS hostname needs MAXHOSTNAMELEN characters of
space (including terminating NULL for the string), and the other stuff
adds up to 18.

Kris

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (FreeBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjoi3BcACgkQWry0BWjoQKWYDwCePSV650ZQeb/V4oWV6Oh3A2ep
zmUAmgMqRZC0f/pKf0sRwVoJFZ6NZLKg
=F91r
-----END PGP SIGNATURE-----

--f2QGlHpHGjS2mn6Y--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




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