Subject: Re: snprintf returns? [was Re: CVS commit: src/sys]
To: Jonathan Stone <jonathan@dsg.stanford.edu>
From: Klaus Klein <kleink@mibh.de>
List: tech-kern
Date: 04/28/2004 23:22:42
On Sunday 25 April 2004 05:31, Jonathan Stone wrote:
> 
> In message <20040425014334.GA24115@jodi.nimenees.,
> com>Eric Haszlakiewicz writes:
> >On Sat, Apr 24, 2004 at 02:27:28PM +0200, Klaus Klein wrote:
> >	huh?  man snprintf, 3rd paragraph of the description:
> 
> ... and you want snprintf(9), not snprintf(3).  (mutatis mutandis, for
> the corresponding implementations).
> 
> Technically, the kernel is a freestanding, non-hosted C environment;
> if [dim] memory serves, that means we can make s[n]printf(9) behave
> differently than s[n]printf(3) --- should we choose to do so.

While that's true (the kernel being a freestanding implementation),
I believe that such a change would not be a beneficial one.

This very discussion has its cause in a change of code to make it
take advantage of the particular behaviour of snprintf() which is
widely regarded as making it suitable for secure programming with
little effort.  Subtle modifications (like this one) to its kernel
incarnation would raise that bar again because it would no longer
behave the same everywhere.



- Klaus