Re: [PATCH] vsprintf.c cleanups

From: Horst von Brand
Date: Fri Feb 25 2005 - 08:39:39 EST


Brian Gerst <bgerst@xxxxxxxxxxxxx> said:
> Horst von Brand wrote:
> > Brian Gerst <bgerst@xxxxxxxxxxxxx> said:
> >
> >>- Make sprintf call vsnprintf directly
> >>- use INT_MAX for sprintf and vsprintf

> > This is the size limit on what is written. 4GiB sounds a bit extreme...

> Sprintf has no limit, which is why it's generally bad to use it. I just
> replaced an open coded ((~0U)>>1) value with the equivalent INT_MAX.

Which is the same as "no limit" in my book. Either you know a limit (in
which case vsprintf() is OK) or you don't (in which case vsnprintf() is
just obfuscation).
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/