libpcap/backport-CVE-2024-8006.patch
2024-09-19 12:38:32 +00:00

43 lines
1.4 KiB
Diff

From 8a633ee5b9ecd9d38a587ac9b204e2380713b0d6 Mon Sep 17 00:00:00 2001
From: Nicolas Badoux <n.badoux@hotmail.com>
Date: Mon, 19 Aug 2024 12:31:53 +0200
Subject: [PATCH] makes pcap_findalldevs_ex errors out if the directory does
not exist
(backported from commit 0f8a103469ce87d2b8d68c5130a46ddb7fb5eb29)
Conflict:Remove unnecessary macros DIAG_OFF_FORMAT_TRUNCATION, DIAG_ON_FORMAT_TRUNCATION
Replacing snprintf with pcap_snprintf
context adapt
Reference:https://github.com/the-tcpdump-group/libpcap/commit/8a633ee5b9ecd9d38a587ac9b204e2380713b0d6
---
pcap-new.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pcap-new.c b/pcap-new.c
index 7c00659..ac88065 100644
--- a/pcap-new.c
+++ b/pcap-new.c
@@ -231,13 +231,18 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t
#else
/* opening the folder */
unixdir= opendir(path);
+ if (unixdir == NULL) {
+ pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+ "Error when listing files: does folder '%s' exist?", path);
+ return -1;
+ }
/* get the first file into it */
filedata= readdir(unixdir);
if (filedata == NULL)
{
- pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' exist?", path);
+ pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' contain files?", path);
return -1;
}
#endif