diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-10-16 00:15:38 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-10-16 00:15:38 -0700 |
commit | 017c240336a375aebd52ec30cf341a207f1c12a4 (patch) | |
tree | 51018597dbbf7efcfeb940e14f0a7bd58ea01095 /pcap-new.c | |
parent | ed63d72f6b9bddab83fc35a957a6a9ff02501d0a (diff) |
Provide out own strlcpy() and strlcat() routines if necessary.
We now depend on the *full* semantics of those routines, including the
return value being usable for truncation checks.
If we're building for a UN*X that has them, define pcap_strl{cpy,cat} to
be strl{cpy,cat}.
If we're building for Windows using MSVC, define pcap_strl{cpy,cat}, not
strl{cpy,cat}.
Otherwise, build our won versions of pcap_strl{cpy,cat} from BSD-derived
source code.
Diffstat (limited to 'pcap-new.c')
-rw-r--r-- | pcap-new.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -299,7 +299,7 @@ int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **all return -1; } - strlcpy(dev->name, tmpstring, stringlen); + pcap_strlcpy(dev->name, tmpstring, stringlen); dev->name[stringlen] = 0; @@ -321,7 +321,7 @@ int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **all } /* Copy the new device description into the correct memory location */ - strlcpy(dev->description, tmpstring, stringlen + 1); + pcap_strlcpy(dev->description, tmpstring, stringlen + 1); pcap_close(fp); } @@ -345,7 +345,7 @@ int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **all return pcap_findalldevs_ex_remote(source, auth, alldevs, errbuf); default: - strlcpy(errbuf, "Source type not supported", PCAP_ERRBUF_SIZE); + pcap_strlcpy(errbuf, "Source type not supported", PCAP_ERRBUF_SIZE); return -1; } } @@ -389,7 +389,7 @@ pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, return pcap_open_rpcap(source, snaplen, flags, read_timeout, auth, errbuf); default: - strlcpy(errbuf, "Source type not supported", PCAP_ERRBUF_SIZE); + pcap_strlcpy(errbuf, "Source type not supported", PCAP_ERRBUF_SIZE); return NULL; } |