libpcap: Fix CVE-2026-6244

NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-6244
Upstream-commit: https://github.com/the-tcpdump-group/libpcap/commit/98bb921b141aa642faedbf2ac510541c76499a19

(From OE-Core rev: 19127ab88cace8da29f70441528474b326a0af4c)

Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
Jaipaul Cheernam authored and Paul Barker committed 2026-10-19 09:03:19 +01:00
1 parent f7b29be290
commit 02a3c6e9ff
2 files changed
+50

No files matched your search

@@ -0,0 +1,49 @@
From 98bb921b141aa642faedbf2ac510541c76499a19 Mon Sep 17 00:00:00 2001
From: Denis Ovsienko <denis@ovsienko.info>
Date: Thu, 30 Jul 2026 13:34:21 +0100
Subject: [PATCH] CVE-2026-6244: Avoid division by zero via pcap_offline_filter().
The current revision of pcapint_filter_with_aux_data() for "div x" and
"mod x" correctly rejects the packet if X is zero, but for "div #k" and
"mod #k" it assumes that k is never zero. This holds for programs that
have been generated or validated by libpcap.
However, this does not necessarily hold for programs that come from an
external source via pcap_offline_filter() or [deprecated] bpf_filter()
and have not been explicitly validated. If the interpreter executes
such a program, it can attempt a division by zero, which will typically
terminate the process via SIGFPE.
To fix this problem, in pcapint_filter_with_aux_data() treat "div #k"
and "mod #k" the same way as "div x" and "mod x".
(backported from commit 0b2b1ad4a1796513613ff68e9dc09049cc8e0af4)
(cherry picked from commit 98bb921b141aa642faedbf2ac510541c76499a19)
Notes on backporting to 1.10.4:
- The upstream CHANGES/changelog hunk is not backported.
Upstream-Status: Backport [https://github.com/the-tcpdump-group/libpcap/commit/98bb921b141aa642faedbf2ac510541c76499a19]
CVE: CVE-2026-6244
Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
---
diff --git a/bpf_filter.c b/bpf_filter.c
index 497b1586..df92c433 100644
--- a/bpf_filter.c
+++ b/bpf_filter.c
@@ -422,10 +422,14 @@ DIAG_ON_DEFAULT_ONLY_SWITCH
continue;
case BPF_ALU|BPF_DIV|BPF_K:
+ if (pc->k == 0)
+ return 0;
A /= pc->k;
continue;
case BPF_ALU|BPF_MOD|BPF_K:
+ if (pc->k == 0)
+ return 0;
A %= pc->k;
continue;
@@ -20,6 +20,7 @@ SRC_URI = "https://www.tcpdump.org/release/${BP}.tar.gz \
file://01-CVE-2026-0799.patch \
file://02-CVE-2026-31912.patch \
file://03-CVE-2026-31911.patch \
file://04-CVE-2026-6244.patch \
"
SRC_URI[sha256sum] = "ed19a0383fad72e3ad435fd239d7cd80d64916b87269550159d20e47160ebe5f"