[Bug c/81117] Improve buffer overflow checking in strncpy

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 13 16:41:00 GMT 2017


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

--- Comment #14 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Dmitry G. Dyachenko from comment #12)

I'm afraid the warning in the constant string case is unavoidable.  The call is
folded at a point where the checker doesn't have access to the subsequent
statement.  At the same time, it can be viewed as a feature since the code
would be more clearly written simply as strcpy(p, "1").


More information about the Gcc-bugs mailing list