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

--- Comment #8 from Marietto <marietto2008 at gmail dot com> ---
https://bugs.launchpad.net/ubuntu/+source/gcc-9/+bug/1892475

Il giorno mar 18 ago 2020 alle ore 19:26 msebor at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> ha scritto:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88780
>
> --- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
> (In reply to Marietto from comment #6)
> ...
> > In function ‘strncpy’,
> > inlined from ‘xc_set_cpufreq_gov’ at xc_pm.c:308:5:
> > /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error:
> > ‘__builtin_strncpy’ specified bound 16 equals destination size
> > [-Werror=stringop-truncation]
> > 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos
> (__dest));
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> This instance of the warning is most likely unrelated to the one reported
> in
> comment #0 (to tell for sure we'd need a test case to reproduce it).  It
> indicates that strncpy is being called with the third argument set to the
> size
> of the destination array, which leaves the destination unterminated unless
> the
> source string is shorter.  The following articles describe the problem and
> the
> suggested solutions in detail:
>
>
> https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/
>
> https://us-cert.cisa.gov/bsi/articles/knowledge/coding-practices/strncpy-and-strncat
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.

Reply via email to