This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=82945

--- Comment #23 from Martin Sebor <msebor at gcc dot gnu.org> ---
I agree that mentioning the attribute in the documentation of the
-Wstringop-truncation option would be helpful.  Let me submit a patch with that
change.

I considered having GCC issue a note suggesting the attribute but decided that
using it was sufficiently rare and specialized that it would be a distraction
in most situations.  Of the warnings the option found in GCC, GDB, and Glibc,
using the attribute was a solution in just three instances so far, all in
Glibc:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=7532837d7b03b3ca5b9a63d77a5bd81dd23f3d9c
 Using attribute nonstring inappropriately could also lead to more warnings
because it triggers its own checks that aren't suitable for nul-terminated
strings -- see pr82945.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]