]> The Tcpdump Group git mirrors - libpcap/commitdiff
Squelch a GCC warning on NetBSD/AArch64. [skip appveyor]
authorDenis Ovsienko <[email protected]>
Wed, 6 Jul 2022 17:41:15 +0000 (18:41 +0100)
committerGuy Harris <[email protected]>
Thu, 14 Jul 2022 05:12:23 +0000 (22:12 -0700)
The warning is a result of upgrading GCC from 10.3 to 12.1 and it pops
up only when GCC is NOT given -O2, which happens when build.sh runs
"make -s CFLAGS=-Werror".  This reproduces with both Autoconf and CMake.

NetBSD netbsd-aarch64 9.2 NetBSD 9.2 (GENERIC64) #0
gcc12 (GCC) 12.1.0

pcap-bpf.c: In function 'bpf_open':
pcap-bpf.c:529:75: error: 'snprintf' output may be truncated before the
  last format character [-Werror=format-truncation=]
pcap-bpf.c:529:31: note: 'snprintf' output between 10 and 20 bytes into
  a destination of size 19

(cherry picked from commit 4e7f6e838acb98d70ba7680c02cb1edd4fd8ad99)

pcap-bpf.c

index 72808ec15df15bd337f49f5cc09c75d99f3a7061..6a8e77470ce91a4a5196e0ded2e4d790b6ea0d6c 100644 (file)
@@ -479,7 +479,7 @@ bpf_open(char *errbuf)
        int fd = -1;
        static const char cloning_device[] = "/dev/bpf";
        int n = 0;
-       char device[sizeof "/dev/bpf0000000000"];
+       char device[sizeof "/dev/bpf00000000000"];
        static int no_cloning_bpf = 0;
 
 #ifdef _AIX