bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/8] kern: fix printing of kmem_cache names


From: Samuel Thibault
Subject: Re: [PATCH 1/8] kern: fix printing of kmem_cache names
Date: Sun, 2 Feb 2014 00:11:59 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Sat 01 Feb 2014 16:34:20 +0100, a écrit :
> Quoting Samuel Thibault (2014-02-01 15:20:55)
> > Justus Winter, le Sat 01 Feb 2014 15:09:21 +0100, a écrit :
> > > The name field is not necessarily zero-terminated.  Use a precision
> > > argument to limit the number of characters written when printing the
> > > name.
> > 
> > Mmm, I'd probably rather see the name field always be zero-terminated,
> > since that's just one place, vs the various places which would want to
> > print it.
> 
> I thought about doing that.  But that would waste one character just
> for the termination.

That's little compared to security :)

> GNU Machs printf implementation supports strings with the precision
> given as argument:
> 
>   printf ("%.*s", sizeof foo->name, foo->name);
> 
> I think thats clean, concise and easy to use.

But people would tend to forget doing it.  We can't really fight that.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]