https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80354

Eric Gallager <egall at gwmail dot gwu.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egall at gwmail dot gwu.edu

--- Comment #4 from Eric Gallager <egall at gwmail dot gwu.edu> ---
(In reply to Martin Sebor from comment #3)
> The warning does just what it's designed to do: point out the potential
> unhandled truncation.  If the argument values are such that the truncation
> cannot occur then using snprintf is unnecessary and sprintf can be used
> instead.

There's other code checking tools (e.g. splint) that say to never use sprintf
and to always use snprintf instead; the manpage on my computer for sprintf also
says to always use snprintf instead. For this reason some projects do
#pragma GCC poison sprintf
in a header file, so sprintf can't actually be used instead in those cases.

Reply via email to