Fix NUL truncation in program files loaded with -f

This fixes CVE-2026-41256.
This commit is contained in:
itchyny committed 2026-04-24 22:15:08 +09:00
1 parent 01b3cded76
commit 5a015deae3
2 files changed
+15

No files matched your search

+7
View File
@@ -886,4 +886,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