[PATCH] *printf: Violation of precision with null string

Jones Desougi jones.desougi at 27m.se
Mon Aug 9 08:14:29 UTC 2010


Bernhard Reutner-Fischer wrote:
> On Thu, Jun 10, 2010 at 03:04:51PM +0200, Jones Desougi wrote:
>> When a string format is processed and the argument is NULL, this yields
>> "(null)" regardless of precision. This does not make sense, precision
>> should not be exceeded. A simple test shows that glibc outputs nothing
>> if precision is smaller than six and the attached patch implements this
>> same behaviour.
> 
> This question seems to pop up repeatedly.
> I think that the current implementation is better since it makes
> programming errors more obvious.

Assuming there is an error to find.
Trashing memory/screen/file you've specifically been asked not to
definitely seems like one however...
Limit it to precision zero only if you like. Then there is no reason to
follow the pointer in the first place.

   /Jones


More information about the uClibc mailing list