Date: Fri, 15 Dec 2000 15:20:17 +1100 From: "Andrew Reilly" <areilly@bigpond.net.au> To: Terry Lambert <tlambert@primenet.com> Cc: Poul-Henning Kamp <phk@critter.freebsd.dk>, kris@citusc.usc.edu, Dag-Erling Smorgrav <des@ofug.org>, arch@FreeBSD.ORG Subject: Re: Safe string formatting in the kernel Message-ID: <20001215152017.A14921@gurney.reilly.home> In-Reply-To: <200012130906.CAA27235@usr08.primenet.com>; from tlambert@primenet.com on Wed, Dec 13, 2000 at 09:06:07AM %2B0000 References: <79446.976697492@critter> <200012130906.CAA27235@usr08.primenet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Dec 13, 2000 at 09:06:07AM +0000, Terry Lambert wrote: > This would let you do the allocation based on peeking at the > size prior to copying the whole string in. Count prefix strings > are one thing the C language has been missing for years. Counted strings are good (lets you put arbitrary binary data into them, for one thing). Putting the count into a control structure as has been suggested here, or passed as another (separate) argument are both also good. Mangling the malloc'd data block so that the first word is a length, irrespective of whatever the data type is, is doubleplus ungood. (That mightn't have been what you meant by count _prefix_ strings, and I apologise if it wasn't, but it sounded like it to me.) -- Andrew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001215152017.A14921>