File libpcap-CVE-2024-8006.patch of Package libpcap.35574
From 7bfeb10956692e5ef0fe435090144be35d33dafc 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 1/2] makes pcap_findalldevs_ex errors out if the directory
does not exist
---
pcap.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Index: libpcap-1.10.1/pcap-new.c
===================================================================
--- libpcap-1.10.1.orig/pcap-new.c
+++ libpcap-1.10.1/pcap-new.c
@@ -231,13 +231,20 @@ int pcap_findalldevs_ex(const char *sour
#else
/* opening the folder */
unixdir= opendir(path);
+ if (unixdir == 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;
+ }
/* get the first file into it */
filedata= readdir(unixdir);
if (filedata == NULL)
{
- snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' exist?", path);
+ snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' contain files?", path);
return -1;
}
#endif