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

--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
You should see the difference in between -D_FORTIFY_SOURCE=2 and
-D_FORTIFY_SOURCE=3 in the attached pre-processed source files.

$ gcc fs2.i -c -O2 -Werror
$ gcc fs3.i -c -O2 -Werror
In file included from /usr/include/string.h:535,
                 from libacl/__acl_to_any_text.c:25:
In function ‘strcpy’,
    inlined from ‘__acl_to_any_text’ at libacl/__acl_to_any_text.c:90:3:
/usr/include/bits/string_fortified.h:79:10: error: ‘__builtin___strcpy_chk’
writing 1 or more bytes into a region of size 0 overflows the destination
[-Werror=stringop-overflow=]
   79 |   return __builtin___strcpy_chk (__dest, __src, __glibc_objsize
(__dest));
      |         
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~               
cc1: all warnings being treated as errors

Note the warning exactly corresponds to the call that aborts during run-time.

Reply via email to