Skip to content

[Bug] gcc 8.3.0 produces many build warnings #634

@fklassen

Description

@fklassen

Since upgrading to Debian Buster I notices several build warnings

To Reproduce
Steps to reproduce the behavior:

  1. build with gcc version 8.3.0 (e.g. Debian Buster)

Expected behavior
no warnings

Screenshots

Making all in scripts
make[1]: Entering directory '/home/fklassen/git/tcpreplay/scripts'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/fklassen/git/tcpreplay/scripts'
Making all in lib
make[1]: Entering directory '/home/fklassen/git/tcpreplay/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/fklassen/git/tcpreplay/lib'
Making all in src
make[1]: Entering directory '/home/fklassen/git/tcpreplay/src'
(CDPATH="${ZSH_VERSION+.}:" && cd .. && /bin/bash /home/fklassen/git/tcpreplay/config/missing autoheader)
rm -f stamp-h1
touch config.h.in
cd .. && /bin/bash ./config.status src/config.h
config.status: creating src/config.h
config.status: src/config.h is unchanged
make  all-recursive
make[2]: Entering directory '/home/fklassen/git/tcpreplay/src'
Making all in common
make[3]: Entering directory '/home/fklassen/git/tcpreplay/src/common'
make  all-am
make[4]: Entering directory '/home/fklassen/git/tcpreplay/src/common'
  CC       cidr.o
cidr.c: In function ‘ip2cidr’:
cidr.c:124:30: warning: ‘snprintf’ output truncated before the last format character [-Wformat-truncation=]
         snprintf(mask, 1, "%d", masklen);
                              ^
cidr.c:124:9: note: ‘snprintf’ output between 2 and 12 bytes into a destination of size 1
         snprintf(mask, 1, "%d", masklen);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  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
  CC       dlt_names.o
  CC       mac.o
  CC       interface.o
interface.c: In function ‘get_interface_list’:
interface.c:209:51: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 244 [-Wformat-truncation=]
                 snprintf(testnic, 254, "/dev/char/%s", dirdata->d_name);
                                                   ^~
interface.c:209:17: note: ‘snprintf’ output between 11 and 266 bytes into a destination of size 254
                 snprintf(testnic, 254, "/dev/char/%s", dirdata->d_name);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
interface.c:211:59: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 237 [-Wformat-truncation=]
                 snprintf(testnic, 255, "khial pseudo-nic: %s", dirdata->d_name);
                                                           ^~
interface.c:211:17: note: ‘snprintf’ output between 19 and 274 bytes into a destination of size 255
                 snprintf(testnic, 255, "khial pseudo-nic: %s", dirdata->d_name);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       flows.o
  CC       txring.o
  AR       libcommon.a
ar: `u' modifier ignored since `D' is the default (see `U')
make[4]: Leaving directory '/home/fklassen/git/tcpreplay/src/common'
make[3]: Leaving directory '/home/fklassen/git/tcpreplay/src/common'
Making all in tcpedit
make[3]: Entering directory '/home/fklassen/git/tcpreplay/src/tcpedit'
make  all-am
make[4]: Entering directory '/home/fklassen/git/tcpreplay/src/tcpedit'
  CC       tcpedit.o
tcpedit.c: In function ‘__tcpedit_seterr’:
tcpedit.c:484:88: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1006 [-Wformat-truncation=]
     snprintf(tcpedit->runtime.errstr, (TCPEDIT_ERRSTR_LEN -1), "From %s:%s() line %d:\n%s",
                                                                                        ^~
         file, func, line, errormsg);
                           ~~~~~~~~                                                      
tcpedit.c:484:5: note: ‘snprintf’ output 18 or more bytes (assuming 1041) into a destination of size 1023
     snprintf(tcpedit->runtime.errstr, (TCPEDIT_ERRSTR_LEN -1), "From %s:%s() line %d:\n%s",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         file, func, line, errormsg);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  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/fklassen/git/tcpreplay/src/tcpedit'
make[3]: Leaving directory '/home/fklassen/git/tcpreplay/src/tcpedit'
make[3]: Entering directory '/home/fklassen/git/tcpreplay/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
tcpreplay_api.c: In function ‘__tcpreplay_seterr’:
tcpreplay_api.c:933:78: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1006 [-Wformat-truncation=]
     snprintf(ctx->errstr, (TCPREPLAY_ERRSTR_LEN -1), "From %s:%s() line %d:\n%s",
                                                                              ^~
         file, func, line, errormsg);
                           ~~~~~~~~                                            
tcpreplay_api.c:933:5: note: ‘snprintf’ output 18 or more bytes (assuming 1041) into a destination of size 1023
     snprintf(ctx->errstr, (TCPREPLAY_ERRSTR_LEN -1), "From %s:%s() line %d:\n%s",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         file, func, line, errormsg);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  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
tcpprep_api.c: In function ‘__tcpprep_seterr’:
tcpprep_api.c:335:78: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1006 [-Wformat-truncation=]
     snprintf(ctx->errstr, (TCPREPLAY_ERRSTR_LEN -1), "From %s:%s() line %d:\n%s",
                                                                              ^~
         file, func, line, errormsg);
                           ~~~~~~~~                                            
tcpprep_api.c:335:5: note: ‘snprintf’ output 18 or more bytes (assuming 1041) into a destination of size 1023
     snprintf(ctx->errstr, (TCPREPLAY_ERRSTR_LEN -1), "From %s:%s() line %d:\n%s",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         file, func, line, errormsg);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  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
tcpreplay_api.c: In function ‘__tcpreplay_seterr’:
tcpreplay_api.c:933:78: warning: ‘%s’ directive output may be truncated writing up to 1023 bytes into a region of size 1006 [-Wformat-truncation=]
     snprintf(ctx->errstr, (TCPREPLAY_ERRSTR_LEN -1), "From %s:%s() line %d:\n%s",
                                                                              ^~
         file, func, line, errormsg);
                           ~~~~~~~~                                            
tcpreplay_api.c:933:5: note: ‘snprintf’ output 18 or more bytes (assuming 1041) into a destination of size 1023
     snprintf(ctx->errstr, (TCPREPLAY_ERRSTR_LEN -1), "From %s:%s() line %d:\n%s",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         file, func, line, errormsg);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  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
bridge.c: In function ‘do_bridge_unidirectional’:
bridge.c:110:13: warning: cast between incompatible function types from ‘int (*)(struct live_data_t *, struct pcap_pkthdr *, const u_char *)’ {aka ‘int (*)(struct live_data_t *, struct pcap_pkthdr *, const unsigned char *)’} to ‘void (*)(u_char *, const struct pcap_pkthdr *, const u_char *)’ {aka ‘void (*)(unsigned char *, const struct pcap_pkthdr *, const unsigned char *)’} [-Wcast-function-type]
             (pcap_handler)live_callback, (u_char *) &livedata)) < 0) {
             ^
bridge.c: In function ‘do_bridge_bidirectional’:
bridge.c:169:51: warning: cast between incompatible function types from ‘int (*)(struct live_data_t *, struct pcap_pkthdr *, const u_char *)’ {aka ‘int (*)(struct live_data_t *, struct pcap_pkthdr *, const unsigned char *)’} to ‘void (*)(u_char *, const struct pcap_pkthdr *, const u_char *)’ {aka ‘void (*)(unsigned char *, const struct pcap_pkthdr *, const unsigned char *)’} [-Wcast-function-type]
                 pcap_dispatch(options->pcap1, -1, (pcap_handler) live_callback,
                                                   ^
bridge.c:178:51: warning: cast between incompatible function types from ‘int (*)(struct live_data_t *, struct pcap_pkthdr *, const u_char *)’ {aka ‘int (*)(struct live_data_t *, struct pcap_pkthdr *, const unsigned char *)’} to ‘void (*)(u_char *, const struct pcap_pkthdr *, const u_char *)’ {aka ‘void (*)(unsigned char *, const struct pcap_pkthdr *, const unsigned char *)’} [-Wcast-function-type]
                 pcap_dispatch(options->pcap2, -1, (pcap_handler) live_callback,
                                                   ^
  CCLD     tcpbridge
  CC       tcpliveplay-tcpliveplay_opts.o
  CC       tcpliveplay-tcpliveplay.o
  CCLD     tcpliveplay

System (please complete the following information):

  • OS: Linux
  • Tcpreplay Version 4.3.3
  • OS
Distributor ID:	Debian
Description:	Debian GNU/Linux 10 (buster)
Release:	10
Codename:	buster

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions