CVE-2024-8006.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 8a633ee5b9ecd9d38a587ac9b204e2380713b0d6 Mon Sep 17 00:00:00 2001
  2. From: Nicolas Badoux <n.badoux@hotmail.com>
  3. Date: Mon, 19 Aug 2024 12:31:53 +0200
  4. Subject: [PATCH] makes pcap_findalldevs_ex errors out if the directory does
  5. not exist
  6. (backported from commit 0f8a103469ce87d2b8d68c5130a46ddb7fb5eb29)
  7. ---
  8. pcap-new.c | 9 ++++++++-
  9. 1 file changed, 8 insertions(+), 1 deletion(-)
  10. diff --git a/pcap-new.c b/pcap-new.c
  11. index be91b3f8db..d449ee623c 100644
  12. --- a/pcap-new.c
  13. +++ b/pcap-new.c
  14. @@ -230,6 +230,13 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t
  15. #else
  16. /* opening the folder */
  17. unixdir= opendir(path);
  18. + if (unixdir == NULL) {
  19. + DIAG_OFF_FORMAT_TRUNCATION
  20. + snprintf(errbuf, PCAP_ERRBUF_SIZE,
  21. + "Error when listing files: does folder '%s' exist?", path);
  22. + DIAG_ON_FORMAT_TRUNCATION
  23. + return -1;
  24. + }
  25. /* get the first file into it */
  26. filedata= readdir(unixdir);
  27. @@ -237,7 +244,7 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t
  28. if (filedata == NULL)
  29. {
  30. DIAG_OFF_FORMAT_TRUNCATION
  31. - snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' exist?", path);
  32. + snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' contain files?", path);
  33. DIAG_ON_FORMAT_TRUNCATION
  34. closedir(unixdir);
  35. return -1;