Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Nov 2000 15:08:32 -0800
From:      Kris Kennaway <kris@citusc.usc.edu>
To:        audit@FreeBSD.org
Subject:   format_ip_addr() in libatm
Message-ID:  <20001126150832.A40399@citusc17.usc.edu>

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

--9amGYk9869ThD9tj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

*sigh* Why is it so hard to understand that DNS addresses can be up to
255 bytes long?

Reviews please.

Kris

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
@@ -154,10 +154,8 @@
 		/*
 		 * Return host name followed by dotted decimal address
 		 */
-		strcpy(host_name, ip_host->h_name);
-		strcat(host_name, " (");
-		strcat(host_name, ip_num);
-		strcat(host_name, ")");
+		snprintf(host_name, sizeof(host_name), "%s (%s)",
+		    ip_host->h_name, ip_num);
 		return(host_name);
 	} else {
 		/*


--9amGYk9869ThD9tj
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

iEYEARECAAYFAjohl+8ACgkQWry0BWjoQKXbzwCfdGnlWs7qsUicDyNoLL/hUa/e
1UIAmgMkSACNOcnbppH5RZJJ/eEI16ri
=4sJX
-----END PGP SIGNATURE-----

--9amGYk9869ThD9tj--


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?20001126150832.A40399>