From owner-freebsd-arch Wed Dec 13 1:21:48 2000 From owner-freebsd-arch@FreeBSD.ORG Wed Dec 13 01:21:44 2000 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from critter.freebsd.dk (flutter.freebsd.dk [212.242.40.147]) by hub.freebsd.org (Postfix) with ESMTP id B9EB437B69D for ; Wed, 13 Dec 2000 01:21:41 -0800 (PST) Received: from critter (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.1/8.11.1) with ESMTP id eBD9KIe88313; Wed, 13 Dec 2000 10:20:18 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Terry Lambert Cc: kris@citusc.usc.edu, des@ofug.org (Dag-Erling Smorgrav), arch@FreeBSD.ORG Subject: Re: Safe string formatting in the kernel In-Reply-To: Your message of "Wed, 13 Dec 2000 09:06:07 GMT." <200012130906.CAA27235@usr08.primenet.com> Date: Wed, 13 Dec 2000 10:20:18 +0100 Message-ID: <88311.976699218@critter> From: Poul-Henning Kamp Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <200012130906.CAA27235@usr08.primenet.com>, Terry Lambert writes: >> >I've been a fan of this approach, ever since I fixed a memory >> >leak in the failure path (submitted via Matt Day in 1997). It >> >is much more robust; I've been troubled by the mount option >> >cruft in BSD, and the more string stuff goes into the kernel, >> >the less happy I become with it. >> >> I don't necessarily see that as a bad thing :-) >> >> The main trouble is bad syscall API design: All strings should be >> passed by pointer+length, rather than asciiz sematics. > >DEFINITELY. > >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. ...unfortunately, just like many other good things, we can't easily change the API of things like open(2)... -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message