appneta / tcpreplay

Pcap editing and replay tools for *NIX and Windows - Users please download source from
http://tcpreplay.appneta.com/wiki/installation.html#downloads
1.17k stars 268 forks source link

[Bug] gcc 9.3 compiler warnings #670

Closed fklassen closed 3 years ago

fklassen commented 3 years ago

Describe the bug Getting complier warnings when compiling with GCC 9.3.0 To Reproduce Steps to reproduce the behavior:

  1. compile on Ubuntu 20.04

Expected behavior No compiler warnings

Screenshots

$ make
Making all in scripts
make[1]: Entering directory '/home/developer/src/tcpreplay-4.3.4/scripts'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/scripts'
Making all in lib
make[1]: Entering directory '/home/developer/src/tcpreplay-4.3.4/lib'
  CC       strlcat.o
  CC       strlcpy.o
  AR       libstrl.a
ar: `u' modifier ignored since `D' is the default (see `U')
make[1]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/lib'
Making all in libopts
make[1]: Entering directory '/home/developer/src/tcpreplay-4.3.4/libopts'
make  all-am
make[2]: Entering directory '/home/developer/src/tcpreplay-4.3.4/libopts'
  CC       libopts_la-libopts.lo
  CCLD     libopts.la
make[2]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/libopts'
make[1]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/libopts'
Making all in src
make[1]: Entering directory '/home/developer/src/tcpreplay-4.3.4/src'
make  all-recursive
make[2]: Entering directory '/home/developer/src/tcpreplay-4.3.4/src'
Making all in common
make[3]: Entering directory '/home/developer/src/tcpreplay-4.3.4/src/common'
make  all-am
make[4]: Entering directory '/home/developer/src/tcpreplay-4.3.4/src/common'
  CC       cidr.o
cidr.c: In function ‘ip2cidr’:
cidr.c:124:39: warning: ‘%d’ directive output may be truncated writing between 2 and 10 bytes into a region of size 3 [-Wformat-truncation=]
  124 |         snprintf(mask, sizeof(mask), "%d", masklen);
      |                                       ^~
cidr.c:124:38: note: directive argument in the range [10, 2147483647]
  124 |         snprintf(mask, sizeof(mask), "%d", masklen);
      |                                      ^~~~
In file included from /usr/include/stdio.h:867,
                 from /usr/include/pcap/pcap.h:93,
                 from /usr/include/pcap.h:43,
                 from ../../src/defines.h:57,
                 from cidr.c:22:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 3 and 11 bytes into a destination of size 3
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cidr.c:121:39: warning: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 3 [-Wformat-truncation=]
  121 |         snprintf(mask, sizeof(mask), "%d", masklen);
      |                                       ^~
cidr.c:121:38: note: directive argument in the range [-2147483648, 9]
  121 |         snprintf(mask, sizeof(mask), "%d", masklen);
      |                                      ^~~~
In file included from /usr/include/stdio.h:867,
                 from /usr/include/pcap/pcap.h:93,
                 from /usr/include/pcap.h:43,
                 from ../../src/defines.h:57,
                 from cidr.c:22:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 2 and 12 bytes into a destination of size 3
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       err.o
  CC       list.o
  CC       cache.o
  CC       services.o
  CC       get.o
  CC       fakepcap.o
  CC       fakepcapnav.o
  CC       fakepoll.o
  CC       xX.o
  CC       utils.o
  CC       timer.o
  CC       git_version.o
  CC       sendpacket.o
In file included from sendpacket.c:122:
/usr/include/x86_64-linux-gnu/sys/sysctl.h:21:2: warning: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Wcpp]
   21 | #warning "The <sys/sysctl.h> header is deprecated and will be removed."
      |  ^~~~~~~
  CC       dlt_names.o
  CC       mac.o
  CC       interface.o
  CC       flows.o
  CC       txring.o
  CC       tcpdump.o
  CC       netmap.o
  AR       libcommon.a
ar: `u' modifier ignored since `D' is the default (see `U')
make[4]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/src/common'
make[3]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/src/common'
Making all in tcpedit
make[3]: Entering directory '/home/developer/src/tcpreplay-4.3.4/src/tcpedit'
make  all-am
make[4]: Entering directory '/home/developer/src/tcpreplay-4.3.4/src/tcpedit'
  CC       tcpedit.o
  CC       parse_args.o
  CC       edit_packet.o
  CC       portmap.o
  CC       dlt.o
  CC       checksum.o
  CC       incremental_checksum.o
  CC       tcpedit_api.o
  CC       fuzzing.o
  CC       rewrite_sequence.o
  CC       plugins/dlt_plugins.o
  CC       plugins/ethernet.o
  CC       plugins/dlt_utils.o
  CC       plugins/dlt_en10mb/en10mb.o
  CC       plugins/dlt_en10mb/en10mb_api.o
  CC       plugins/dlt_hdlc/hdlc.o
  CC       plugins/dlt_hdlc/hdlc_api.o
  CC       plugins/dlt_user/user.o
  CC       plugins/dlt_user/user_api.o
  CC       plugins/dlt_raw/raw.o
  CC       plugins/dlt_null/null.o
  CC       plugins/dlt_loop/loop.o
  CC       plugins/dlt_linuxsll/linuxsll.o
  CC       plugins/dlt_ieee80211/ieee80211.o
  CC       plugins/dlt_ieee80211/ieee80211_hdr.o
  CC       plugins/dlt_radiotap/radiotap.o
  CC       plugins/dlt_jnpr_ether/jnpr_ether.o
  CC       plugins/dlt_pppserial/pppserial.o
  AR       libtcpedit.a
ar: `u' modifier ignored since `D' is the default (see `U')
make[4]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/src/tcpedit'
make[3]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/src/tcpedit'
make[3]: Entering directory '/home/developer/src/tcpreplay-4.3.4/src'
  CC       tcpreplay-tcpreplay_opts.o
  CC       tcpreplay-send_packets.o
  CC       tcpreplay-signal_handler.o
  CC       tcpreplay-tcpreplay.o
  CC       tcpreplay-tcpreplay_api.o
  CC       tcpreplay-sleep.o
  CC       tcpreplay-replay.o
  CCLD     tcpreplay
  CC       tcpprep-tcpprep_opts.o
  CC       tcpprep-tcpprep.o
  CC       tcpprep-tree.o
  CC       tcpprep-tcpprep_api.o
  CCLD     tcpprep
  CC       tcprewrite-tcprewrite_opts.o
  CC       tcprewrite-tcprewrite.o
  CCLD     tcprewrite
  CC       tcpreplay_edit-tcpreplay_edit_opts.o
  CC       tcpreplay_edit-send_packets.o
  CC       tcpreplay_edit-signal_handler.o
  CC       tcpreplay_edit-tcpreplay.o
  CC       tcpreplay_edit-tcpreplay_api.o
  CC       tcpreplay_edit-sleep.o
  CC       tcpreplay_edit-replay.o
  CCLD     tcpreplay-edit
  CC       tcpcapinfo-tcpcapinfo_opts.o
  CC       tcpcapinfo-tcpcapinfo.o
  CCLD     tcpcapinfo
  CC       tcpbridge-tcpbridge_opts.o
  CC       tcpbridge-tcpbridge.o
  CC       tcpbridge-bridge.o
  CCLD     tcpbridge
  CC       tcpliveplay-tcpliveplay_opts.o
  CC       tcpliveplay-tcpliveplay.o
  CCLD     tcpliveplay
make[3]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/src'
make[2]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/src'
make[1]: Leaving directory '/home/developer/src/tcpreplay-4.3.4/src'
make[1]: Entering directory '/home/developer/src/tcpreplay-4.3.4'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/home/developer/src/tcpreplay-4.3.4'

System (please complete the following information):

fklassen commented 3 years ago

Fixed in PR #672