diff options
| author | Ruoyu Wang <ruoyuw560@gmail.com> | 2026-08-15 23:17:45 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-10-01 14:01:14 +0200 |
| commit | 6edddc1d101bfd5cafc94ca2dffaf13e4394662d (patch) | |
| tree | a6b240ef227709b25df82f4226a2497f51a1c870 /tools/lib/python/kdoc/python_version.py | |
| parent | e15596e84c818a2b727d2a7cf742a29331e44c43 (diff) | |
misc: nsm: fix CBOR short-length decoding
CBOR encodes byte-string lengths from 0 through 23 directly in the
additional-information field. cbor_object_get_array() only handles 23,
so shorter byte strings leave array_len uninitialized. Reserved values
28 through 30 and the unsupported indefinite-length encoding also fall
through without assigning it.
parse_resp_get_random() then uses the indeterminate value for bounds
checking and as the byte count returned to the hwrng core. This can
reject a valid short response or report an incorrect amount of entropy.
Decode the complete inline-length range and reject unsupported values.
Extended definite-length encodings retain their existing behavior, and
the existing size and INT_MAX checks continue to bound the returned
slice.
This issue was found by a static analysis checker and confirmed by
manual source review.
Fixes: b9873755a6c8 ("misc: Add Nitro Secure Module driver")
Assisted-by: unnamed:claude-opus-4.8 typestate
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Link: https://patch.msgid.link/20260815151745.3758574-1-ruoyuw560@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
