Fix NUL truncation in the JSON parser
This fixes CVE-2026-33948.
This commit is contained in:
1 parent
fdf8ef0f08
commit
6374ae0bcd
2 files changed
+7
-7
No files matched your search
+1
-7
@@ -312,13 +312,7 @@ static int jq_util_input_read_more(jq_util_input_state *state) {
|
|||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
state->current_line++;
|
state->current_line++;
|
||||||
|
|
||||||
if (p == NULL && state->parser != NULL) {
|
if (p == NULL && feof(state->current_input)) {
|
||||||
/*
|
|
||||||
* There should be no NULs in JSON texts (but JSON text
|
|
||||||
* sequences are another story).
|
|
||||||
*/
|
|
||||||
state->buf_valid_len = strlen(state->buf);
|
|
||||||
} else if (p == NULL && feof(state->current_input)) {
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -880,4 +880,10 @@ $JQ -nf $d/prog.jq 2> $d/out && {
|
|||||||
}
|
}
|
||||||
diff $d/out $d/expected
|
diff $d/out $d/expected
|
||||||
|
|
||||||
|
# CVE-2026-33948: No NUL truncation in the JSON parser
|
||||||
|
if printf '{}\x00{}' | $JQ >/dev/null 2> /dev/null; then
|
||||||
|
printf 'Error expected but jq exited successfully\n' 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
Reference in new issue
Block a user