[Bug stdio/17829] Incorrect handling of precision specifier in printf family

vincent-srcware at vinc17 dot net sourceware-bugzilla@sourceware.org
Mon May 22 14:53:00 GMT 2017


https://sourceware.org/bugzilla/show_bug.cgi?id=17829

--- Comment #13 from Vincent Lefèvre <vincent-srcware at vinc17 dot net> ---
(In reply to Florian Weimer from comment #12)
> (In reply to Vincent Lefèvre from comment #11)
> > (In reply to Florian Weimer from comment #10)
> > > See bug 14771 comment 4.
> > 
> > This is a different issue. I'm not talking about the size argument, but the
> > 'n' format specifier.
> 
> They are related.

Bug 14771 comment 4 was about a conflict between ISO C and POSIX, and doesn't
give a hint here.

> I'm not sure if it is reasonable to expect that if snprintf fails with
> EOVERFLOW, %n output has been written.

There is no %n output. %n allows one to get information about the length of
some sequence of characters. According to bug 21360, one should get a
"meaningful" value, even for something that would *never* be output. So, if one
follows this idea, it could be reasonable to expect a meaningful value if int
is too small for the return value, e.g. to overcome the limitation of the int
type.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list