greenbone / openvas-scanner

This repository contains the scanner component for Greenbone Community Edition.

Home Page:https://greenbone.github.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[20.8.1] gcc 9.3.1 can't build the source code

tuxmaster5000 opened this issue · comments

The build on CentOS7 fails with:

cd /builddir/build/BUILD/openvas-20.8.1/my_build/misc && /usr/lib64/ccache/cc -DOPENVAS_DATA_DIR=\"/usr/share/openvas\" -DOPENVAS_FEED_LOCK_PATH=\"/run/greenbone/feed-update.lock\" -DOPENVAS_STATE_DIR=\"/var/lib/greenbone/lib/openvas\" -DOPENVAS_SYSCONF_DIR=\"/etc/openvas\" -Dopenvas_misc_shared_EXPORTS -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/gvm -I/usr/include/gvm-helper  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1  -m64 -mtune=generic -D_FILE_OFFSET_BITS=64 -DLARGEFILE_SOURCE=1 -Wall -D_BSD_SOURCE -D_ISOC99_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE -Wall -Wextra -fPIC -g  -Werror -fPIC   -o CMakeFiles/openvas_misc_shared.dir/strutils.c.o   -c /builddir/build/BUILD/openvas-20.8.1/misc/strutils.c
In file included from /usr/include/string.h:638,
                 from /usr/include/glib-2.0/glib/gtestutils.h:30,
                 from /usr/include/glib-2.0/glib.h:82,
                 from /builddir/build/BUILD/openvas-20.8.1/misc/scanneraux.h:28,
                 from /builddir/build/BUILD/openvas-20.8.1/misc/network.h:29,
                 from /builddir/build/BUILD/openvas-20.8.1/misc/pcap.c:22:
In function 'strncpy',
    inlined from 'getinterfaces' at /builddir/build/BUILD/openvas-20.8.1/misc/pcap.c:461:7:
/usr/include/bits/string3.h:120:10: error: '__builtin_strncpy' output may be truncated copying 63 bytes from a string of length 10239 [-Werror=stringop-truncation]
  120 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from 'getipv4routes' at /builddir/build/BUILD/openvas-20.8.1/misc/pcap.c:625:11:
/usr/include/bits/string3.h:120:10: error: '__builtin_strncpy' specified bound 64 equals destination size [-Werror=stringop-truncation]
  120 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
    inlined from 'routethrough' at /builddir/build/BUILD/openvas-20.8.1/misc/pcap.c:1117:15:
/usr/include/bits/string3.h:120:10: error: '__builtin_strncpy' specified bound 64 equals destination size [-Werror=stringop-truncation]
  120 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [misc/CMakeFiles/openvas_misc_shared.dir/pcap.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/builddir/build/BUILD/openvas-20.8.1/my_build'
make[1]: Leaving directory `/builddir/build/BUILD/openvas-20.8.1/my_build'
make[1]: *** [misc/CMakeFiles/openvas_misc_shared.dir/all] Error 2
make: *** [all] Error 2

When the source code is safe, then an gcc pragma statement can be used.

The PR is only an hot fix, some one with deep source code knowledge can provide an better patch.