diff options
author | Denis Ovsienko <denis@ovsienko.info> | 2018-07-14 08:57:25 +0000 |
---|---|---|
committer | Denis Ovsienko <denis@ovsienko.info> | 2018-07-14 09:01:27 +0000 |
commit | 8cccd1dded942df5760eaf5b5d8faf1938a723f0 (patch) | |
tree | 83970ad75073a2032d2fb6e17a82f1731a141357 /nametoaddr.c | |
parent | 2743ab9ee055c1500c5e41127dadf2e1be59e812 (diff) | |
download | libpcap-8cccd1dded942df5760eaf5b5d8faf1938a723f0.tar.gz |
Address the warnings from -Wformat-truncation.
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,
^~~~~~~~~~~~~
Diffstat (limited to 'nametoaddr.c')
0 files changed, 0 insertions, 0 deletions