Date: Tue, 12 Dec 2000 23:43:22 +0100 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: Warner Losh <imp@village.org> Cc: Dag-Erling Smorgrav <des@ofug.org>, assar@FreeBSD.ORG, Matt Dillon <dillon@earth.backplane.com>, kris@citusc.usc.edu, arch@FreeBSD.ORG Subject: Re: Safe string formatting in the kernel Message-ID: <55081.976661002@critter> In-Reply-To: Your message of "Tue, 12 Dec 2000 15:28:27 MST." <200012122228.PAA33203@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <200012122228.PAA33203@harmony.village.org>, Warner Losh writes: >In message <xzplmtlfkkf.fsf@flood.ping.uio.no> Dag-Erling Smorgrav writes: >: Warner Losh <imp@village.org> writes: >: > Just be careful that your dynamic string growing things don't violate >: > the hard limit invariants in the kernel. If it produces paths longer >: > than 1023 characters, for example, it is wrong. >: >: Code manipulating path names would specify a hard upper limit of >: MAXPATHLEN. > >If there's a known, realtively small, upper limit, why does allocating >it dynamically buy you when you could have a static buffer? I know >that it costs you a trip into the kernel malloc routines which can be >quite high at times. I have not reread DES's implementation, but in my design doc you could initialize an sbuf with your own buffer, for exactly that reason. -- 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55081.976661002>