diff options
| author | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-09-11 23:13:06 +0900 |
|---|---|---|
| committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-10-11 10:29:43 +0900 |
| commit | fac634087ad85d2c6845cf3ead4fbf520274ca49 (patch) | |
| tree | 5abc06fff475194496a11842638331b0d93e6612 /include/linux/threads.h | |
| parent | 958c01049e0a81a02370c9fce50670cda8478b1b (diff) | |
bootconfig: Reject unexpected data after null character
If a bootconfig buffer contains an intermediate null character in the
middle of the configuration, xbc_parse_tree() stops at the null character
because string delimiter searches (e.g. strpbrk()) stop at '\0', and
cleanly breaks out of the loop without error. As a result, any
configuration data following the intermediate null character is silently
ignored, allowing unparsed or potentially malicious data to be hidden
after an early termination.
Fix this in xbc_parse_tree() by checking that no non-null data remains
between the parser termination point and the end of the input buffer.
Trailing null characters (such as alignment padding in initrd) continue
to be accepted as valid.
Also update apply_xbc() in tools/bootconfig/main.c to calculate the
buffer size based on the loaded file size rather than strlen(), so that
files with intermediate null characters are not truncated before
validation.
Link: https://lore.kernel.org/all/178913598628.248794.1048773774471250986.stgit@devnote2/
Assisted-by: LLM
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Diffstat (limited to 'include/linux/threads.h')
0 files changed, 0 insertions, 0 deletions
