mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-07-15 16:07:26 +00:00
jq: Fix CVE-2026-41256
The upstream fix [3] is for a newer jq codebase. Debian has already backported this fix in jq 1.8.1-6. Use the Debian patch [1], which fixes this CVE as tracked in Debian bug #1136445 [2]. [1] https://sources.debian.org/src/jq/1.8.1-7/debian/patches/CVE-2026-41256.patch [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1136445 [3] https://github.com/jqlang/jq/commit/5a015deae35d19e3ebbc65db6c157a80e76df738 Reference: https://github.com/jqlang/jq/security/advisories/GHSA-vf2h-chrj-q3fg Signed-off-by: Shubham Pushpkar <spushpka@cisco.com> Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
This commit is contained in:
committed by
Anuj Mittal
parent
92546d9ec0
commit
d2c778bb20
@@ -0,0 +1,54 @@
|
||||
From f4efca339cadef8ce7a5d5be98d0d2a8e0a77989 Mon Sep 17 00:00:00 2001
|
||||
From: itchyny <itchyny@cybozu.co.jp>
|
||||
Date: Fri, 24 Apr 2026 22:15:08 +0900
|
||||
Subject: [PATCH] Fix NUL truncation in program files loaded with -f
|
||||
|
||||
This fixes CVE-2026-41256.
|
||||
|
||||
CVE: CVE-2026-41256
|
||||
Upstream-Status: Backport [https://github.com/jqlang/jq/commit/5a015deae35d19e3ebbc65db6c157a80e76df738]
|
||||
|
||||
(cherry picked from commit 5a015deae35d19e3ebbc65db6c157a80e76df738)
|
||||
Signed-off-by: Shubham Pushpkar <spushpka@cisco.com>
|
||||
---
|
||||
src/main.c | 8 ++++++++
|
||||
tests/shtest | 7 +++++++
|
||||
2 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index 43586c4..f462e4d 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -677,6 +677,14 @@ int main(int argc, char* argv[]) {
|
||||
ret = JQ_ERROR_SYSTEM;
|
||||
goto out;
|
||||
}
|
||||
+ int len = jv_string_length_bytes(jv_copy(data));
|
||||
+ if ((size_t)len != strlen(jv_string_value(data))) {
|
||||
+ fprintf(stderr, "jq: program file contains NUL bytes\n");
|
||||
+ free(program_origin);
|
||||
+ jv_free(data);
|
||||
+ ret = JQ_ERROR_SYSTEM;
|
||||
+ goto out;
|
||||
+ }
|
||||
jq_set_attr(jq, jv_string("PROGRAM_ORIGIN"), jq_realpath(jv_string(dirname(program_origin))));
|
||||
ARGS = JV_OBJECT(jv_string("positional"), ARGS,
|
||||
jv_string("named"), jv_copy(program_arguments));
|
||||
diff --git a/tests/shtest b/tests/shtest
|
||||
index 0397ca0..505d45d 100755
|
||||
--- a/tests/shtest
|
||||
+++ b/tests/shtest
|
||||
@@ -615,4 +615,11 @@ if printf '{}\x00{}' | $JQ >/dev/null 2> /dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
+# CVE-2026-41256: No NUL truncation in program files loaded with -f
|
||||
+printf '.\x00invalid' > "$d/nul_prog.jq"
|
||||
+if echo '42' | $JQ -f "$d/nul_prog.jq" >/dev/null 2>/dev/null; then
|
||||
+ printf 'Error expected for program file with NUL bytes\n' 1>&2
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
exit 0
|
||||
--
|
||||
2.44.4
|
||||
@@ -21,6 +21,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \
|
||||
file://CVE-2026-33948.patch \
|
||||
file://CVE-2026-39979.patch \
|
||||
file://CVE-2026-40612.patch \
|
||||
file://CVE-2026-41256.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "478c9ca129fd2e3443fe27314b455e211e0d8c60bc8ff7df703873deeee580c2"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user