From owner-freebsd-hackers Sat May 12 19:37:57 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from obsecurity.dyndns.org (adsl-63-207-60-32.dsl.lsan03.pacbell.net [63.207.60.32]) by hub.freebsd.org (Postfix) with ESMTP id F19D537B43E for ; Sat, 12 May 2001 19:37:54 -0700 (PDT) (envelope-from kris@obsecurity.org) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id 9B7C966C04; Sat, 12 May 2001 19:37:54 -0700 (PDT) Date: Sat, 12 May 2001 19:37:54 -0700 From: Kris Kennaway To: Daniel Hemmerich Cc: freebsd-hackers@freebsd.org Subject: Re: adding a new function to libc Message-ID: <20010512193754.A47253@xor.obsecurity.org> References: <01051202104500.95296@blackhole.BSDpro.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="KsGdsel6WgEHnImy" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <01051202104500.95296@blackhole.BSDpro.com>; from dan@BSDpro.com on Sat, May 12, 2001 at 02:10:45AM -0400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --KsGdsel6WgEHnImy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 12, 2001 at 02:10:45AM -0400, Daniel Hemmerich wrote: > Any comments, suggestions, swears concerning adding a new function,=20 > strndup(), to libc? >=20 > So that instead of permitting it to attempt to allocate a large chunk of= =20 > memory, it is possible to give it a max length. #include int main(int argc, char **argv) { char *p; asprintf(&p, "%.*s", 100, argv[1]); printf("%s %d\n", p, strlen(p)); } Kris --KsGdsel6WgEHnImy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.5 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE6/fOBWry0BWjoQKURAhMTAKDyzA+tsHhVYVBpJwQQIFqvhdf+cgCeI02s 5t8WOV+SaBoyO2tE3FzM/Pg= =EThX -----END PGP SIGNATURE----- --KsGdsel6WgEHnImy-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message