linux/kernel/debug
Christophe JAILLET 4f41d30cd6 kdb: Fix a potential buffer overflow in kdb_local()
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>
2024-01-17 17:19:06 +00:00
..
kdb kdb: Fix a potential buffer overflow in kdb_local() 2024-01-17 17:19:06 +00:00
debug_core.c kgdb: Flush console before entering kgdb on panic 2023-10-15 18:07:50 +01:00
debug_core.h kdb: Fix stack crawling on 'running' CPUs that aren't the master 2019-10-10 16:28:48 +01:00
gdbstub.c kernel: debug: Convert to SPDX identifier 2021-09-06 14:31:11 +01:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00