linux-stable/kernel/debug/kdb
Christophe JAILLET 99719bb0c2 kdb: Fix a potential buffer overflow in kdb_local()
[ Upstream commit 4f41d30cd6 ]

When appending "[defcmd]" to 'kdb_prompt_str', the size of the string
already in the buffer should be taken into account.

An option could be to switch from strncat() to strlcat() which does the
correct test to avoid such an overflow.

However, this actually looks as dead code, because 'defcmd_in_progress'
can't be true here.
See a more detailed explanation at [1].

[1]: https://lore.kernel.org/all/CAD=FV=WSh7wKN7Yp-3wWiDgX4E3isQ8uh0LCzTmd1v9Cg9j+nQ@mail.gmail.com/

Fixes: 5d5314d679 ("kdb: core for kgdb back end (1 of 2)")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-25 15:36:00 -08:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
kdb_bp.c kdb: Rename members of struct kdbtab_t 2021-07-27 17:05:06 +01:00
kdb_bt.c kdb: Adopt scheduler's task classification 2021-11-03 17:21:37 +00:00
kdb_cmds
kdb_debugger.c kdb: Get rid of custom debug heap allocator 2021-07-27 14:46:11 +01:00
kdb_io.c printk changes for 6.6 2023-09-04 13:20:19 -07:00
kdb_keyboard.c kdb: include kdb_private.h for function prototypes 2023-06-29 15:10:17 +01:00
kdb_main.c kdb: Fix a potential buffer overflow in kdb_local() 2024-01-25 15:36:00 -08:00
kdb_private.h kdb: move kdb_send_sig() declaration to a better header file 2023-07-03 09:27:12 +01:00
kdb_support.c module: Move kdb module related code out of main kdb code 2022-04-05 08:43:04 -07:00
Makefile kdb: Get rid of broken attempt to print CCVERSION in kdb summary 2019-05-12 09:50:43 +01:00