diff options
author | Guy Harris <gharris@sonic.net> | 2022-03-08 15:18:24 -0800 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2022-03-08 15:18:24 -0800 |
commit | f6fb59b11d20222d4648cdceeaadf6ce971a7a9a (patch) | |
tree | 82d4be40231a93047587a9cd52777b77528e188d /pcap-new.c | |
parent | cc9e70b80e0a33130fcb24fbab13a40666976d7f (diff) | |
parent | e75cc82c46e0f1208fbac03530da6a30976c7fd6 (diff) |
Merge branch 'master' into pcap-options
Diffstat (limited to 'pcap-new.c')
-rw-r--r-- | pcap-new.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -36,6 +36,7 @@ #endif #include "ftmacros.h" +#include "diag-control.h" /* * sockutils.h may include <crtdbg.h> on Windows, and pcap-int.h will @@ -237,7 +238,9 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t if (filedata == NULL) { + DIAG_OFF_FORMAT_TRUNCATION snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' exist?", path); + DIAG_ON_FORMAT_TRUNCATION return -1; } #endif @@ -253,7 +256,9 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t #else if (pathlen + strlen(filedata->d_name) >= sizeof(filename)) continue; + DIAG_OFF_FORMAT_TRUNCATION snprintf(filename, sizeof(filename), "%s%s", path, filedata->d_name); + DIAG_ON_FORMAT_TRUNCATION #endif fp = pcap_open_offline(filename, errbuf); @@ -444,6 +449,7 @@ pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, return fp; fail: + DIAG_OFF_FORMAT_TRUNCATION if (status == PCAP_ERROR) snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", name, fp->errbuf); @@ -455,6 +461,7 @@ fail: else snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", name, pcap_statustostr(status)); + DIAG_ON_FORMAT_TRUNCATION pcap_close(fp); return NULL; } |