Debug mode output broken

Paolo Carlini pcarlini@suse.de
Fri Aug 6 12:44:00 GMT 2004


Jonathan Wakely wrote:

>First of all, please note that __n is not the buffer size here, it's the
>length of the word to be copied. snprintf() is not used to prevent __buf
>from being overflowed, it's used to prevent the whole of __s being copied.
>  
>
Please have a look to the whole debug.cc: most of the times, according 
to a very
common practice, snprintf is passed exactly __bufsize.

There is only *one* case, _M_print_string, where the second parameter of 
snprintf
is used for the other purpose that you are emphasizing above.

That's why we have a bug: someone replaced snprintf (when not available) 
with
sprintf considering only the former uses of _M_format_word. We have to deal
correctly with the exception represented by _M_print_string.

Paolo.



More information about the Libstdc++ mailing list