intel / openlldp

Other
54 stars 42 forks source link

New GCC9 warning: error: '__builtin_strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation] #23

Closed marxin closed 5 years ago

marxin commented 5 years ago

Seen here:

[   58s] gcc -DPACKAGE_NAME=\"lldpad\" -DPACKAGE_TARNAME=\"lldpad\" -DPACKAGE_VERSION=\"1.0.1\" -DPACKAGE_STRING=\"lldpad\ 1.0.1\" -DPACKAGE_BUGREPORT=\"lldp-devel@open-lldp.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"lldpad\" -DVERSION=\"1.0.1\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_ALARM=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_INET_NTOA=1 -DHAVE_LOCALTIME_R=1 -DHAVE_MEMMOVE=1 -DHAVE_MEMSET=1 -DHAVE_MKDIR=1 -DHAVE_RMDIR=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_STRCASECMP=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_STRNCASECMP=1 -DHAVE_STRPBRK=1 -DHAVE_STRRCHR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOUL=1 -DHAVE_UNAME=1 -DHAVE_ARPA_INET_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_LIMITS_H=1 -DHAVE_NETDB_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_SYS_FILE_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYSLOG_H=1 -DHAVE_UNISTD_H=1 -DHAVE_CHOWN=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_STDLIB_H=1 -DHAVE_REALLOC=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -I.  -I./include -DSYSCONFDIR="\"/etc\"" -D_FORTIFY_SOURCE=2  -Wall -Werror -Wextra -Wformat=2  -I/usr/include/libnl3 -fomit-frame-pointer -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -c -o lldp_dcbx_nl.o lldp_dcbx_nl.c
[   58s] In file included from /usr/include/string.h:494,
[   58s]                  from lldp_dcbx_nl.c:29:
[   58s] In function 'strncpy',
[   58s]     inlined from 'get_dcb_numtcs' at lldp_dcbx_nl.c:564:2:
[   58s] /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
[   58s]   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
[   58s]       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mojtabaayoubi commented 3 years ago

How can I fix this error?

marxin commented 3 years ago

How can I fix this error?

It's fixed in master.