diff options
| author | Josh Law <objecting@objecting.org> | 2026-03-12 19:11:43 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-03-19 16:15:27 +0100 |
| commit | ad6008ca4e33e65c0c0799c33ff53cc34e77e755 (patch) | |
| tree | f4cfbff4da25742c1442148c5720b8661d379583 /lib/bootconfig-data.S | |
| parent | bb7d3a79491e40213491bfc1eb7cf9c8eb80ea97 (diff) | |
lib/bootconfig: fix snprintf truncation check in xbc_node_compose_key_after()
commit 1120a36bb1e9b9e22de75ecb4ef0b998f73a97f1 upstream.
snprintf() returns the number of characters that would have been
written excluding the NUL terminator. Output is truncated when the
return value is >= the buffer size, not just > the buffer size.
When ret == size, the current code takes the non-truncated path,
advancing buf by ret and reducing size to 0. This is wrong because
the output was actually truncated (the last character was replaced by
NUL). Fix by using >= so the truncation path is taken correctly.
Link: https://lore.kernel.org/all/20260312191143.28719-4-objecting@objecting.org/
Fixes: 76db5a27a827 ("bootconfig: Add Extra Boot Config support")
Cc: stable@vger.kernel.org
Signed-off-by: Josh Law <objecting@objecting.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/bootconfig-data.S')
0 files changed, 0 insertions, 0 deletions
