ntop / n2n

Peer-to-peer VPN
GNU General Public License v3.0
6.05k stars 925 forks source link

Another compile warning on linux Debian 10 #1136

Closed galaxyskyknight closed 10 months ago

galaxyskyknight commented 1 year ago
Build for version: 3.1.1-209-g183e0c9
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/edge.o src/edge.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/aes.o src/aes.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/auth.o src/auth.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/cc20.o src/cc20.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/curve25519.o src/curve25519.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/edge_management.o src/edge_management.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/edge_utils.o src/edge_utils.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/edge_utils_win32.o src/edge_utils_win32.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/header_encryption.o src/header_encryption.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/hexdump.o src/hexdump.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/json.o src/json.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/management.o src/management.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/minilzo.o src/minilzo.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/n2n.o src/n2n.c
src/n2n.c: In function ‘resolve_check’:
src/n2n.c:749:45: warning: ‘]:’ directive output may be truncated writing 2 bytes into a region of size between 0 and 63 [-Wformat-truncation=]
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
                                             ^~
src/n2n.c:749:41: note: using the range [0, 65535] for directive argument
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
                                         ^~~~~~~~~~
src/n2n.c:749:9: note: ‘snprintf’ output between 5 and 72 bytes into a destination of size 64
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/n2n.c: In function ‘sock_to_cstr’:
src/n2n.c:749:45: warning: ‘]:’ directive output may be truncated writing 2 bytes into a region of size between 0 and 63 [-Wformat-truncation=]
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
                                             ^~
src/n2n.c:749:41: note: using the range [0, 65535] for directive argument
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
                                         ^~~~~~~~~~
src/n2n.c:749:9: note: ‘snprintf’ output between 5 and 72 bytes into a destination of size 64
         snprintf(out, N2N_SOCKBUF_SIZE, "[%s]:%hu", tmp[0] ? tmp : "", sock->port);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/n2n_port_mapping.o src/n2n_port_mapping.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/n2n_regex.o src/n2n_regex.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/network_traffic_filter.o src/network_traffic_filter.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/pearson.o src/pearson.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/random_numbers.o src/random_numbers.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/sn_management.o src/sn_management.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/sn_selection.o src/sn_selection.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/sn_utils.o src/sn_utils.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/speck.o src/speck.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/tf.o src/tf.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_aes.o src/transform_aes.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_cc20.o src/transform_cc20.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_lzo.o src/transform_lzo.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_null.o src/transform_null.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_speck.o src/transform_speck.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_tf.o src/transform_tf.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/transform_zstd.o src/transform_zstd.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/tuntap_freebsd.o src/tuntap_freebsd.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/tuntap_linux.o src/tuntap_linux.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/tuntap_netbsd.o src/tuntap_netbsd.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/tuntap_osx.o src/tuntap_osx.c
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/wire.o src/wire.c
ar rcs libn2n.a src/aes.o src/auth.o src/cc20.o src/curve25519.o src/edge_management.o src/edge_utils.o src/edge_utils_win32.o src/header_encryption.o src/hexdump.o src/json.o src/management.o src/minilzo.o src/n2n.o src/n2n_port_mapping.o src/n2n_regex.o src/network_traffic_filter.o src/pearson.o src/random_numbers.o src/sn_management.o src/sn_selection.o src/sn_utils.o src/speck.o src/tf.o src/transform_aes.o src/transform_cc20.o src/transform_lzo.o src/transform_null.o src/transform_speck.o src/transform_tf.o src/transform_zstd.o src/tuntap_freebsd.o src/tuntap_linux.o src/tuntap_netbsd.o src/tuntap_osx.o src/wire.o
gcc  -L.  src/edge.o libn2n.a   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o src/edge
cp src/edge edge
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/supernode.o src/supernode.c
gcc  -L.  src/supernode.o libn2n.a   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o src/supernode
cp src/supernode supernode
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/example_edge_embed_quick_edge_init.o src/example_edge_embed_quick_edge_init.c
gcc  -L.  src/example_edge_embed_quick_edge_init.o libn2n.a   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o src/example_edge_embed_quick_edge_init
cp src/example_edge_embed_quick_edge_init example_edge_embed_quick_edge_init
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/example_edge_embed.o src/example_edge_embed.c
gcc  -L.  src/example_edge_embed.o libn2n.a   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o src/example_edge_embed
cp src/example_edge_embed example_edge_embed
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall     -c -o src/example_sn_embed.o src/example_sn_embed.c
gcc  -L.  src/example_sn_embed.o libn2n.a   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o src/example_sn_embed
cp src/example_sn_embed example_sn_embed
gzip -n -c edge.8 > edge.8.gz
gzip -n -c supernode.1 > supernode.1.gz
gzip -n -c n2n.7 > n2n.7.gz
make -C tools
make[1]: Entering directory '/root/n2n-3.0/tools'
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -c -o n2n-benchmark.o n2n-benchmark.c
gcc  -L. -L..  n2n-benchmark.o   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o n2n-benchmark
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -c -o n2n-keygen.o n2n-keygen.c
gcc  -L. -L..  n2n-keygen.o   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o n2n-keygen
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -c -o n2n-route.o n2n-route.c
gcc  -L. -L..  n2n-route.o   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o n2n-route
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -c -o n2n-portfwd.o n2n-portfwd.c
gcc  -L. -L..  n2n-portfwd.o   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o n2n-portfwd
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -c -o n2n-decode.o n2n-decode.c
gcc  -L. -L..  n2n-decode.o   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o n2n-decode
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -L. -L..  tests-compress.c   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-compress
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -L. -L..  tests-elliptic.c   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-elliptic
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -L. -L..  tests-hashing.c   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-hashing
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -L. -L..  tests-transform.c   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-transform
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -L. -L..  tests-wire.c   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-wire
gcc -O3 -DN2N_OPTION_USE_PORTMAPPING -I./include    -Wall   -I../include -g3   -L. -L..  tests-auth.c   -ln2n -lpthread -lcap -lpcap -lnatpmp -lminiupnpc  -o tests-auth
make[1]: Leaving directory '/root/n2n-3.0/tools'
hamishcoleman commented 1 year ago

Debian 10 is quite old now. This warning is not seen in Debian 11, Debian 12, Ubuntu 20.04 or Ubuntu 22.04.

It is warning about an unlikely truncation and unless you are seeing issues in normal use, it can almost certainly be ignored

galaxyskyknight commented 1 year ago

Debian 10 is quite old now. This warning is not seen in Debian 11, Debian 12, Ubuntu 20.04 or Ubuntu 22.04.

It is warning about an unlikely truncation and unless you are seeing issues in normal use, it can almost certainly be ignored

OK, I will upgrade my OS and see, thanks

hamishcoleman commented 1 year ago

Can you give https://github.com/ntop/n2n/pull/1137 a try? I believe it addresses the specific warning you are seeing