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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |msebor at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The warning is intended (and designed to trigger across inlined function
calls).  The call to snprintf() truncates the string which may be unintended.

To avoid the warning either use the return value of the snprintf function to
take some action (i.e., handle the truncation) or use the len argument to
specify the precision of the %s directive like so:

    snprintf (b, sizeof b, "%.*s", (int)len, s);

Reply via email to