aboutsummaryrefslogtreecommitdiff
path: root/pcap-new.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap-new.c')
-rw-r--r--pcap-new.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pcap-new.c b/pcap-new.c
index 7c006595..77b08ae1 100644
--- a/pcap-new.c
+++ b/pcap-new.c
@@ -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;
}