Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Dec 2009 11:53:43 +0100
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Dag-Erling Sm??rgrav <des@des.no>
Cc:        svn-src-head@freebsd.org, Ed Schouten <ed@80386.nl>, svn-src-all@freebsd.org, src-committers@freebsd.org, Hajimu UMEMOTO <ume@freebsd.org>
Subject:   the need for safe dynamic string libraries (was Re: svn commit: r200157 - head/bin/date)
Message-ID:  <20091207105343.GA62012@onelab2.iet.unipi.it>
In-Reply-To: <86iqcjt93c.fsf@ds4.des.no>
References:  <200912052009.nB5K9okL098577@svn.freebsd.org> <ygek4wzpdv3.wl%ume@mahoroba.org> <20091207055752.GD64905@hoeg.nl> <20091207085927.GC57764@onelab2.iet.unipi.it> <86iqcjt93c.fsf@ds4.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 07, 2009 at 10:41:11AM +0100, Dag-Erling Sm??rgrav wrote:
> Luigi Rizzo <rizzo@iet.unipi.it> writes:
> > Also, things like lsbuf are really useful in general, so having
> > that widely available would be a good incentive for people to
> > use it instead of rolling their own 'dynamic string manipulation'
> > code again and again
> 
> Userland libsbuf is an abomination.  I wish I had protested more
> strenuously when the CAM people insisted on using the same code in
> userland as in the kernel; we actually lost functionality in the kernel
> version as a result.

What do you mean exactly ?

In any case i don't care whether we use the same or different code
in userland and kernel, but i do care that we converge on one library
to handle dynamic strings in a safe way, and promote the use of
that library for our userland base code.
One way to promote this is to put the code in libc so even lazy
people won't need to remember to pass linker flags when using the library.

Otherwise lots of people are going to use unsafe or non-reentrant
variants based on sprintf/snprintf , even in the libraries.
Just grep -r sprintf or snprintf in src/lib and you'll see how
bad the situation is.

libsbuf is as good as anything else with the same features.

cheers
luigi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091207105343.GA62012>