summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>2026-09-11 23:13:06 +0900
committerAndrew Morton <akpm@linux-foundation.org>2026-10-06 19:03:06 -0700
commitca68d27fca329df09b3c2ad36f1fe9d7b2970b22 (patch)
tree00b118f0b61581b459b1638872fcca7a2f700b1b /tools/lib/python
parent2ed685ec634490502d8b36148432a70c13859d6a (diff)
downloadlinux-next-ca68d27fca329df09b3c2ad36f1fe9d7b2970b22.tar.gz
linux-next-ca68d27fca329df09b3c2ad36f1fe9d7b2970b22.zip
bootconfig: reject unexpected data after null character
Patch series "bootconfig: Reject unexpected data after null character and cleanups", v2. Make bootconfig reject unexpected config data after null character and implement other cleanups including tools/bootconfig to consolidate bootconfig initialization with errors, and to skip internal tree sanity checks in kernel. This patch (of 4): 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/178913597653.248794.1237187523153227751.stgit@devnote2 Link: https://lore.kernel.org/178913598628.248794.1048773774471250986.stgit@devnote2 Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Sang-Heon Jeon <ekffu200098@gmail.com> Assisted-by: Antigravity:gemini-3.8-flash
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions