Libiberty's snprintf for v3?

Nathan Myers ncm-nospam@cantrip.org
Tue Apr 22 02:49:00 GMT 2003


On Mon, Apr 21, 2003 at 09:24:38PM +0200, Paolo Carlini wrote:
> now that snprintf is available in libiberty we can consider actually 
> using it in v3.
> 
> I briefly recall (for Kaveh and the accidental readers) that currently 
> we use either snprintf or the unsafe sprintf depending on 
> _GLIBCPP_USE_C99 (see config/locale/gnu/c_locale.h).
> 
> Having snprintf unconditionally available would simplify and made safer 
> a few functions in include/bits/locale_facets.tcc

It seems to me that we should be able to establish an upper bound
on the number of characters that can be produced by a printf format
for these uses, so that sprintf itself should be safe.  What am I 
missing?

Nathan Myers
ncm-nospam@cantrip.org



More information about the Libstdc++ mailing list