This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Debug mode output broken
Jonathan Wakely wrote:
Except _M_format_word() isn't called on the expanded string, so that's
not a problem.
Ah, ok then, one risk of buffer overlow less ;)
The unexpanded string still needs to be short enough to
fit in the buffer though.
Maybe this should be added to _M_print_string(), before the while loop:
As I said we should really avoid all those dangerous functions and rewrite
cleanly the code to use stringstreams or file streams directly. Without
breaking
the 3.4 ABI, however, it's not so easy :(
AFAICT FreeBSD has had snprintf() since version 1.0 (see [1])
so the test _could_ be changed to:
In general, the mere presence of something named snprintf is not sufficient:
we need the specific version standardized in C99. In particular, the first
implementations had a different, less useful, return value.
Paolo.