GCC 7.3.0-16ubuntu3 is concerned about the fact that building one error
message from another can lose some trailing characters, given the sizes
of the input and the output buffers. Use argument-specified precision to
indicate that this effect is intentional. This change squelches the
following warnings:
./pcap.c: In function ‘pcap_open_live’:
./pcap.c:2534:48: warning: ‘%s’ directive output may be truncated writing up to 256 bytes into a region of size 254 [-Wformat-truncation=]
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", device,
^~
In file included from ./pcap-int.h:388:0,
from ./pcap.c:79:
./portability.h:125:23: note: ‘snprintf’ output 3 or more bytes (assuming 259) into a destination of size 256
#define pcap_snprintf snprintf
./pcap.c:2534:3: note: in expansion of macro ‘pcap_snprintf’
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", device,
^~~~~~~~~~~~~
./pcap.c:2539:52: warning: ‘%s’ directive output may be truncated writing up to 256 bytes into a region of size 252 [-Wformat-truncation=]
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%s)", device,
^~
In file included from ./pcap-int.h:388:0,
from ./pcap.c:79:
./portability.h:125:23: note: ‘snprintf’ output 6 or more bytes (assuming 262) into a destination of size 256
#define pcap_snprintf snprintf
./pcap.c:2539:3: note: in expansion of macro ‘pcap_snprintf’
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%s)", device,
^~~~~~~~~~~~~